Search in sources :

Example 16 with DataDomainClient

use of com.emc.storageos.datadomain.restapi.DataDomainClient in project coprhd-controller by CoprHD.

the class DataDomainFileStorageDevice method getDataDomainClient.

/**
 * Get DataDomain device represented by the StorageDevice
 *
 * @param device StorageDevice object
 * @return DataDomainClient object
 * @throws com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException
 */
private DataDomainClient getDataDomainClient(StorageSystem device) throws DataDomainApiException {
    URI providerId = device.getActiveProviderURI();
    StorageProvider provider = null;
    if (providerId != null) {
        provider = _dbClient.queryObject(StorageProvider.class, providerId);
    }
    DataDomainClient ddClient = null;
    if (provider != null) {
        ddClient = (DataDomainClient) _factory.getRESTClient(DataDomainApiConstants.newDataDomainBaseURI(device.getSmisProviderIP(), device.getSmisPortNumber()), provider.getUserName(), provider.getPassword());
    }
    return ddClient;
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) DataDomainClient(com.emc.storageos.datadomain.restapi.DataDomainClient)

Example 17 with DataDomainClient

use of com.emc.storageos.datadomain.restapi.DataDomainClient in project coprhd-controller by CoprHD.

the class DataDomainUtils method refreshDDConnections.

/**
 * Refresh DataDomain connections.
 *
 * @param ddProviderList the DataDomain provider list
 * @param dbClient the db client
 * @return the list of active providers
 */
public static List<URI> refreshDDConnections(final List<StorageProvider> ddProviderList, DbClient dbClient, DataDomainClientFactory ddClientFactory) {
    List<URI> activeProviders = new ArrayList<URI>();
    for (StorageProvider storageProvider : ddProviderList) {
        try {
            // Is the DDMC reachable
            DataDomainClient ddClient = getDataDomainClient(storageProvider, ddClientFactory);
            if (ddClient == null) {
                storageProvider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
                _log.error("Storage Provider {} is not reachable", storageProvider.getIPAddress());
            } else {
                ddClient.getManagementSystemInfo();
                storageProvider.setConnectionStatus(ConnectionStatus.CONNECTED.name());
                activeProviders.add(storageProvider.getId());
                _log.info("Storage Provider {} is reachable", storageProvider.getIPAddress());
            }
        } catch (Exception e) {
            storageProvider.setConnectionStatus(ConnectionStatus.NOTCONNECTED.name());
            _log.error("Storage Provider {} is not reachable", storageProvider.getIPAddress());
        } finally {
            dbClient.persistObject(storageProvider);
        }
    }
    return activeProviders;
}
Also used : ArrayList(java.util.ArrayList) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) DataDomainClient(com.emc.storageos.datadomain.restapi.DataDomainClient) DataDomainApiException(com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException)

Aggregations

DataDomainClient (com.emc.storageos.datadomain.restapi.DataDomainClient)17 DataDomainApiException (com.emc.storageos.datadomain.restapi.errorhandling.DataDomainApiException)14 URI (java.net.URI)12 StoragePool (com.emc.storageos.db.client.model.StoragePool)8 ArrayList (java.util.ArrayList)7 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)5 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)5 DataDomainResourceNotFoundException (com.emc.storageos.datadomain.restapi.errorhandling.DataDomainResourceNotFoundException)4 SMBShareMap (com.emc.storageos.db.client.model.SMBShareMap)4 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)3 FileExport (com.emc.storageos.db.client.model.FileExport)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 DDMCInfoDetail (com.emc.storageos.datadomain.restapi.model.DDMCInfoDetail)2 DDMTreeInfo (com.emc.storageos.datadomain.restapi.model.DDMTreeInfo)2 DDServiceStatus (com.emc.storageos.datadomain.restapi.model.DDServiceStatus)2 FileShare (com.emc.storageos.db.client.model.FileShare)2 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 ExportRule (com.emc.storageos.model.file.ExportRule)2 DDMTreeInfoDetail (com.emc.storageos.datadomain.restapi.model.DDMTreeInfoDetail)1 DDMtreeCapacityInfos (com.emc.storageos.datadomain.restapi.model.DDMtreeCapacityInfos)1