use of com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException in project coprhd-controller by CoprHD.
the class DataDomainCommunicationInterface method discoverMtrees.
private void discoverMtrees(DataDomainClient ddClient, StorageSystem storageSystem) {
URIQueryResultList mtreeList = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceFileshareConstraint(storageSystem.getId()), mtreeList);
Iterator<URI> mtreeItr = mtreeList.iterator();
while (mtreeItr.hasNext()) {
FileShare mtree = _dbClient.queryObject(FileShare.class, mtreeItr.next());
if (!mtree.getInactive()) {
try {
DDMTreeInfoDetail mtreeInfo = ddClient.getMTree(storageSystem.getNativeGuid(), mtree.getNativeId());
if (mtreeInfo.quotaConfig != null) {
// it should be always true.
// We do not inject resources without quota
mtree.setCapacity(mtreeInfo.quotaConfig.getHardLimit());
}
mtree.setUsedCapacity(mtreeInfo.logicalCapacity.getUsed());
} catch (DataDomainResourceNotFoundException ex) {
mtree.setCapacity(0L);
} catch (DataDomainApiException dex) {
mtree.setCapacity(0L);
}
}
}
}
use of com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException in project coprhd-controller by CoprHD.
the class DataDomainFileStorageDevice method doCheckFSExists.
@Override
public boolean doCheckFSExists(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_log.info("checking file system existence on array: ", args.getFsName());
boolean isMtreeExists = true;
try {
DataDomainClient ddClient = getDataDomainClient(storage);
URI storagePoolId = args.getFs().getPool();
StoragePool storagePool = _dbClient.queryObject(StoragePool.class, storagePoolId);
DDMTreeInfoDetail mtreeInfo = ddClient.getMTree(storagePool.getNativeId(), args.getFs().getNativeId());
if (mtreeInfo != null && (mtreeInfo.id.equals(args.getFsNativeId()))) {
isMtreeExists = true;
}
} catch (DataDomainResourceNotFoundException e) {
_log.info("Mtree not found.", e);
isMtreeExists = false;
}
return isMtreeExists;
}
use of com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException 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