use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException 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);
}
}
Aggregations