use of com.emc.storageos.datadomain.restapi.model.DDServiceStatus in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method ddDeleteShares.
private void ddDeleteShares(DataDomainClient ddClient, String storagePoolId, SMBShareMap currentShares, List<SMBFileShare> sharesToDelete) {
if ((currentShares != null && (sharesToDelete != null))) {
for (SMBFileShare fileShare : sharesToDelete) {
String key = fileShare.getName();
String ddShareId = null;
SMBFileShare fShare = currentShares.get(key);
if (fShare != null) {
ddShareId = fShare.getNativeId();
}
if (ddShareId != null) {
DDServiceStatus ddSvcStatus = ddClient.deleteShare(storagePoolId, ddShareId);
if (ddSvcStatus.getCode() == DataDomainApiConstants.SVC_CODE_SUCCESS) {
currentShares.remove(key);
}
}
}
}
}
use of com.emc.storageos.datadomain.restapi.model.DDServiceStatus in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method ddDeleteExports.
private void ddDeleteExports(DataDomainClient ddClient, String storagePoolId, FSExportMap currentExports, List<FileExport> exportsToDelete) {
if ((currentExports != null && (exportsToDelete != null) && (!exportsToDelete.isEmpty()))) {
for (FileExport fileExport : exportsToDelete) {
String key = fileExport.getFileExportKey();
String ddExportId = null;
FileExport fExport = currentExports.get(key);
if (fExport != null) {
ddExportId = fExport.getNativeId();
}
if (ddExportId != null) {
DDExportInfoDetail ddExport = ddClient.getExport(storagePoolId, ddExportId);
if (ddExport.getPathStatus() == DataDomainApiConstants.PATH_EXISTS) {
DDServiceStatus ddSvcStatus = ddClient.deleteExport(storagePoolId, ddExportId);
}
}
}
}
}
use of com.emc.storageos.datadomain.restapi.model.DDServiceStatus in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method doDeleteFsExport.
private void doDeleteFsExport(DataDomainClient ddClient, String storagePoolId, String ddExportId) throws DataDomainApiException {
if (ddExportId != null) {
DDServiceStatus ddSvcStatus = ddClient.deleteExport(storagePoolId, ddExportId);
if (ddSvcStatus.getCode() != DataDomainApiConstants.SVC_CODE_SUCCESS) {
StringBuilder message = new StringBuilder(ddSvcStatus.getCode());
message.append(": " + ddSvcStatus.getDetails());
throw DataDomainApiException.exceptions.failedToDeleteExport(message.toString());
}
}
}
use of com.emc.storageos.datadomain.restapi.model.DDServiceStatus in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method doDeleteFS.
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
try {
_log.info("DataDomainFileStorageDevice doDeleteFS {} - start", args.getFsId());
DataDomainClient ddClient = getDataDomainClient(storage);
if (ddClient == null) {
_log.error("doDeleteFS failed, provider unreachable");
String op = "FS delete";
return BiosCommandResult.createErrorResult(DeviceControllerErrors.datadomain.operationFailedProviderInaccessible(op));
}
URI storagePoolId = args.getFs().getPool();
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, storagePoolId);
// Delete the exports for this file system
FSExportMap exportMap = args.getFsExports();
List<FileExport> exportMapvalues = null;
if (exportMap != null) {
exportMapvalues = new ArrayList<>(exportMap.values());
}
if ((exportMap != null) && (exportMapvalues != null)) {
try {
ddDeleteExports(ddClient, storagePool.getNativeId(), exportMap, exportMapvalues);
} catch (DataDomainApiException dde) {
_log.error("Unable to delete exports for the FS: ", dde);
}
}
// Delete the SMB shares for this file system
SMBShareMap shareMap = args.getFsShares();
List<SMBFileShare> shareMapValues = null;
if (shareMap != null) {
shareMapValues = new ArrayList<>(shareMap.values());
}
if ((shareMap != null) && (shareMapValues != null)) {
try {
ddDeleteShares(ddClient, storagePool.getNativeId(), shareMap, shareMapValues);
} catch (DataDomainApiException dde) {
_log.error("Unable to delete cifs shares for the FS: ", dde);
}
}
// Delete mtree on the DD array
DDServiceStatus ddSvcStatus = ddClient.deleteMTree(storagePool.getNativeId(), args.getFs().getNativeId());
_log.info("DataDomainFileStorageDevice doDeleteFS {} - complete", args.getFsId());
return BiosCommandResult.createSuccessfulResult();
} catch (DataDomainApiException e) {
_log.error("doDeleteFS failed, device error", e);
return BiosCommandResult.createErrorResult(e);
} catch (DataDomainResourceNotFoundException e) {
_log.error("doDeleteFS failed, Mtree not found.", e);
return BiosCommandResult.createErrorResult(e);
}
}
Aggregations