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;
}
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;
}
Aggregations