use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class XtremioStorageSystemToStorageProviderMigration method process.
/**
* 1. Iterate each storage systems.
* a) Create new StorageProvider instance per xtremio storage system instance available in db.
* b) Update the newly created storage provider Id reference with the xtremio storage system using provider.setStorageSystems().
* c) Need to change storageSystem.activeProviderURI and storageSystem.getProviders() with the newly created
* StorageProvider id.
*/
@Override
public void process() throws MigrationCallbackException {
DbClient dbClient = getDbClient();
try {
List<URI> storageSystemURIList = dbClient.queryByType(StorageSystem.class, true);
List<StorageSystem> storageSystemsList = dbClient.queryObject(StorageSystem.class, storageSystemURIList);
Iterator<StorageSystem> systemItr = storageSystemsList.iterator();
List<StorageSystem> systemsToUpdate = new ArrayList<StorageSystem>();
List<StorageProvider> storageProvidersToCreate = new ArrayList<StorageProvider>();
while (systemItr.hasNext()) {
StorageSystem storageSystem = systemItr.next();
// perform storagesystem upgrade only for XtremIO storagesystems.
if (DiscoveredDataObject.Type.xtremio.name().equalsIgnoreCase(storageSystem.getSystemType())) {
storageProvidersToCreate.add(createNewStorageProviderInstance(storageSystem));
}
}
dbClient.createObject(storageProvidersToCreate);
// persist all systems here.
dbClient.persistObject(systemsToUpdate);
} catch (Exception e) {
log.error("Exception occured while updating xtremio storagesystem to storage provider model");
log.error(e.getMessage(), e);
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class XtremioStorageSystemToStorageProviderMigration method createNewStorageProviderInstance.
/**
* Creates new StorageProvider instance for the given storage system while doing db upgrade.
*
* @param smisProvider
* @return {@link StorageProvider} newly created StorageProvider instance
*/
private StorageProvider createNewStorageProviderInstance(StorageSystem xioSystem) {
log.info("Creating a new storage provider for storage system {}", xioSystem.getLabel());
StorageProvider storageProvider = new StorageProvider();
storageProvider.setId(URIUtil.createId(StorageProvider.class));
storageProvider.setCompatibilityStatus(xioSystem.getCompatibilityStatus());
// Set connectionStatus as Connected always, Let scan validate the connection later.
storageProvider.setConnectionStatus(StorageProvider.ConnectionStatus.CONNECTED.name());
storageProvider.setCreationTime(xioSystem.getCreationTime());
storageProvider.setInterfaceType(StorageProvider.InterfaceType.xtremio.name());
storageProvider.setIPAddress(xioSystem.getIpAddress());
storageProvider.setLabel(xioSystem.getLabel());
storageProvider.setLastScanStatusMessage(xioSystem.getLastDiscoveryStatusMessage());
storageProvider.setLastScanTime(xioSystem.getLastDiscoveryRunTime());
storageProvider.setPassword(xioSystem.getPassword());
storageProvider.setPortNumber(xioSystem.getPortNumber());
storageProvider.setRegistrationStatus(xioSystem.getRegistrationStatus());
storageProvider.setScanStatus(xioSystem.getDiscoveryStatus());
storageProvider.setOpStatus(xioSystem.getOpStatus());
storageProvider.setSuccessScanTime(xioSystem.getSuccessDiscoveryTime());
storageProvider.setTag(xioSystem.getTag());
storageProvider.setUserName(xioSystem.getUsername());
storageProvider.setVersionString(xioSystem.getFirmwareVersion());
log.info("Adding the storage system to the storage provider");
storageProvider.addStorageSystem(dbClient, xioSystem, true);
return storageProvider;
}
use of com.emc.storageos.db.client.model.StorageProvider 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.db.client.model.StorageProvider 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;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class HDSStorageDevice method validateStorageProviderConnection.
@Override
public boolean validateStorageProviderConnection(String ipAddress, Integer portNumber) {
boolean isConnectionValid = false;
try {
StringBuffer providerID = new StringBuffer(ipAddress).append(HDSConstants.HYPHEN_OPERATOR).append(portNumber);
URIQueryResultList providerUriList = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageProviderByProviderIDConstraint(providerID.toString()), providerUriList);
if (providerUriList.iterator().hasNext()) {
StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerUriList.iterator().next());
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(provider), provider.getUserName(), provider.getPassword());
List<StorageArray> storageArrayList = hdsApiClient.getStorageSystemsInfo();
if (null != storageArrayList && !storageArrayList.isEmpty()) {
isConnectionValid = true;
}
}
} catch (Exception ex) {
log.error("Problem in checking provider live connection for ipaddress: {} due to", ipAddress, ex);
}
return isConnectionValid;
}
Aggregations