Search in sources :

Example 1 with DataDomainResourceNotFoundException

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);
            }
        }
    }
}
Also used : DataDomainApiException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException) DataDomainResourceNotFoundException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException) DDMTreeInfoDetail(com.emc.storageos.datadomain.restapi.model.DDMTreeInfoDetail) URI(java.net.URI) FileShare(com.emc.storageos.db.client.model.FileShare) UnManagedSMBFileShare(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 2 with DataDomainResourceNotFoundException

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;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) DataDomainResourceNotFoundException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException) DDMTreeInfoDetail(com.emc.storageos.datadomain.restapi.model.DDMTreeInfoDetail) DataDomainClient(com.emc.storageos.datadomain.restapi.DataDomainClient) URI(java.net.URI)

Example 3 with DataDomainResourceNotFoundException

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);
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) SMBShareMap(com.emc.storageos.db.client.model.SMBShareMap) DDServiceStatus(com.emc.storageos.datadomain.restapi.model.DDServiceStatus) DataDomainResourceNotFoundException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException) FSExportMap(com.emc.storageos.db.client.model.FSExportMap) DataDomainClient(com.emc.storageos.datadomain.restapi.DataDomainClient) URI(java.net.URI) DataDomainApiException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException) FileExport(com.emc.storageos.db.client.model.FileExport) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare)

Aggregations

DataDomainResourceNotFoundException (com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException)3 URI (java.net.URI)3 DataDomainClient (com.emc.storageos.datadomain.restapi.DataDomainClient)2 DataDomainApiException (com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException)2 DDMTreeInfoDetail (com.emc.storageos.datadomain.restapi.model.DDMTreeInfoDetail)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 DDServiceStatus (com.emc.storageos.datadomain.restapi.model.DDServiceStatus)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)1 FileExport (com.emc.storageos.db.client.model.FileExport)1 FileShare (com.emc.storageos.db.client.model.FileShare)1 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)1 SMBShareMap (com.emc.storageos.db.client.model.SMBShareMap)1 UnManagedSMBFileShare (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare)1