use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SMISProviderToStorageProviderMigration method process.
/**
* 1. Create new StorageProvider instance per smis provider instance available in db.
* 2. Populate all existing fields into new StorageProvider instance except id and interfaceType.
* 3. Generate new id for the new instance. interfaceType will be "smis" in this case.
* 4. Persist new instance into db.
* 5: Update the newly created storage provider Id reference with the all storage systems managed by smis provider.
* a) : Fetch storageSystems using provider.getStorageSystems()
* b) : Iterate each storage systems.
* c) : Needs to change storageSystem.activeProviderURI and storageSystem.getProviders() with the newly created
* StorageProvider id. In this step we need to remove the existing smis provider id add new storage provider id
*/
@Override
public void process() throws MigrationCallbackException {
DbClient dbClient = getDbClient();
try {
List<URI> smisProviderURIList = dbClient.queryByType(SMISProvider.class, true);
Iterator<SMISProvider> smisProviderListIterator = dbClient.queryIterativeObjects(SMISProvider.class, smisProviderURIList);
while (smisProviderListIterator.hasNext()) {
SMISProvider smisProvider = smisProviderListIterator.next();
StorageProvider newStorageProvider = createNewStorageProviderInstance(smisProvider);
dbClient.createObject(newStorageProvider);
StringSet storageSystemSet = smisProvider.getStorageSystems();
if (storageSystemSet != null) {
for (String strStorageSystem : storageSystemSet) {
URI storageSystemURI = URI.create(strStorageSystem);
StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storageSystemURI);
updateStorageProvidersforStorageSystems(dbClient, storageSystem, smisProvider, newStorageProvider);
smisProvider.setInactive(true);
dbClient.persistObject(smisProvider);
}
}
}
// Handle VPLEX storage systems, which are now discovered using the
// StorageProvider model.
List<URI> storageSystemURIs = dbClient.queryByType(StorageSystem.class, true);
Iterator<StorageSystem> storageSystemIter = dbClient.queryIterativeObjects(StorageSystem.class, storageSystemURIs);
while (storageSystemIter.hasNext()) {
StorageSystem storageSystem = storageSystemIter.next();
if (DiscoveredDataObject.Type.vplex.name().equals(storageSystem.getSystemType())) {
createStorageProviderForVPlexSystem(storageSystem);
}
}
} catch (Exception e) {
log.error("Exception occured while migrating SMISProvider CF to StorageProvider");
log.error(e.getMessage(), e);
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SMISProviderToStorageProviderMigration method createStorageProviderForVPlexSystem.
/**
* Creates a new storage provider representing the VPLEX management server
* used to manage the pass VPLEX storage system. Also, updates the VPLEX
* storage system itself to set the provider list and active provider to
* this new storage provider.
*
* @param vplexSystem An active VPLEX storage system in ViPR.
*/
private void createStorageProviderForVPlexSystem(StorageSystem vplexSystem) {
// We'll create a new storage provider representing the VPLEX management
// server used to manage this VPLEX storage system.
StorageProvider vplexMgmntSvr = new StorageProvider();
URI vplexMgmntSvrURI = URIUtil.createId(StorageProvider.class);
vplexMgmntSvr.setId(vplexMgmntSvrURI);
vplexMgmntSvr.setInterfaceType(StorageProvider.InterfaceType.vplex.name());
vplexMgmntSvr.setIPAddress(vplexSystem.getIpAddress());
vplexMgmntSvr.setPortNumber(vplexSystem.getPortNumber());
vplexMgmntSvr.setUseSSL(Boolean.TRUE);
vplexMgmntSvr.setUserName(vplexSystem.getUsername());
vplexMgmntSvr.setPassword(vplexSystem.getPassword());
vplexMgmntSvr.setLabel(vplexSystem.getLabel());
vplexMgmntSvr.setVersionString(vplexSystem.getFirmwareVersion());
vplexMgmntSvr.setCompatibilityStatus(vplexSystem.getCompatibilityStatus());
vplexMgmntSvr.setRegistrationStatus(vplexSystem.getRegistrationStatus());
vplexMgmntSvr.setConnectionStatus(StorageProvider.ConnectionStatus.CONNECTED.name());
StringSet managedStorageSystems = new StringSet();
managedStorageSystems.add(vplexSystem.getId().toString());
vplexMgmntSvr.setStorageSystems(managedStorageSystems);
dbClient.createObject(vplexMgmntSvr);
// Now update the providers and active provider for the VPLEX system.
StringSet vplexMgmntServers = new StringSet();
vplexMgmntServers.add(vplexMgmntSvrURI.toString());
vplexSystem.setProviders(vplexMgmntServers);
vplexSystem.setActiveProviderURI(vplexMgmntSvrURI);
dbClient.updateAndReindexObject(vplexSystem);
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class SMISProviderToStorageProviderMigration method createNewStorageProviderInstance.
/**
* Creates new StorageProvider instance for the given smis provider while doing db upgrade.
*
* @param smisProvider
* @return {@link StorageProvider} newly created StorageProvider instance
*/
private StorageProvider createNewStorageProviderInstance(SMISProvider smisProvider) {
StorageProvider storageProvider = new StorageProvider();
storageProvider.setId(URIUtil.createId(StorageProvider.class));
storageProvider.setCompatibilityStatus(smisProvider.getCompatibilityStatus());
storageProvider.setConnectionStatus(smisProvider.getConnectionStatus());
storageProvider.setCreationTime(smisProvider.getCreationTime());
storageProvider.setDecommissionedSystems(smisProvider.getDecommissionedSystems());
storageProvider.setDescription(smisProvider.getDescription());
storageProvider.setInterfaceType(StorageProvider.InterfaceType.smis.name());
storageProvider.setIPAddress(smisProvider.getIPAddress());
storageProvider.setLabel(smisProvider.getLabel());
storageProvider.setLastScanStatusMessage(smisProvider.getLastScanStatusMessage());
storageProvider.setLastScanTime(smisProvider.getLastScanTime());
storageProvider.setManufacturer(smisProvider.getManufacturer());
storageProvider.setNextScanTime(smisProvider.getNextScanTime());
storageProvider.setPassword(smisProvider.getPassword());
storageProvider.setPortNumber(smisProvider.getPortNumber());
storageProvider.setProviderID(smisProvider.getProviderID());
storageProvider.setRegistrationStatus(smisProvider.getRegistrationStatus());
storageProvider.setScanStatus(smisProvider.getScanStatus());
storageProvider.setOpStatus(smisProvider.getOpStatus());
StringSet storageSystems = smisProvider.getStorageSystems();
if (storageSystems != null) {
StringSet newStoargeSystems = new StringSet();
newStoargeSystems.addAll(storageSystems);
storageProvider.setStorageSystems(newStoargeSystems);
}
storageProvider.setSuccessScanTime(smisProvider.getSuccessScanTime());
storageProvider.setTag(smisProvider.getTag());
storageProvider.setUserName(smisProvider.getUserName());
storageProvider.setUseSSL(smisProvider.getUseSSL());
storageProvider.setVersionString(smisProvider.getVersionString());
return storageProvider;
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class XioStorageSystemToStorageProviderMigrationTest method verifyResults.
@Override
protected void verifyResults() throws Exception {
List<URI> storageSystemKeys = _dbClient.queryByType(StorageSystem.class, true);
Iterator<StorageSystem> iter = _dbClient.queryIterativeObjects(StorageSystem.class, storageSystemKeys);
while (iter.hasNext()) {
StorageSystem storageSystem = iter.next();
if (DiscoveredDataObject.Type.xtremio.name().equals(storageSystem.getSystemType())) {
URI providerURI = storageSystem.getActiveProviderURI();
Assert.assertNotNull("XtremIO storage system should have an active provider associated.", providerURI);
StorageProvider provider = _dbClient.queryObject(StorageProvider.class, providerURI);
Assert.assertTrue("Storage provider is not associated with the xtremio storage system", provider.getStorageSystems().contains(storageSystem.getId().toString()));
}
}
}
use of com.emc.storageos.db.client.model.StorageProvider in project coprhd-controller by CoprHD.
the class StoragePortHADomainPopulater method createStorageAdapter.
private StorageHADomain createStorageAdapter(StorageSystem storageSystem, DbClient dbClient) {
String cinderHostName = "";
URI providerUri = storageSystem.getActiveProviderURI();
StorageProvider provider = dbClient.queryObject(StorageProvider.class, providerUri);
if (null != provider && null != provider.getKeys()) {
cinderHostName = provider.getKeyValue("CINDER_HOST_NAME");
}
String adapterNativeGUID = generateNativeGuid(storageSystem, cinderHostName, "ADAPTER");
StorageHADomain adapter = new StorageHADomain();
adapter.setStorageDeviceURI(storageSystem.getId());
adapter.setId(URIUtil.createId(StorageHADomain.class));
adapter.setAdapterName(cinderHostName);
adapter.setLabel(cinderHostName);
adapter.setNativeGuid(adapterNativeGUID);
adapter.setNumberofPorts("1");
adapter.setAdapterType(StorageHADomain.HADomainType.FRONTEND.name());
adapter.setInactive(false);
dbClient.createObject(adapter);
return adapter;
}
Aggregations