Search in sources :

Example 36 with MigrationCallbackException

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);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) ArrayList(java.util.ArrayList) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) MigrationCallbackException(com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)36 URI (java.net.URI)25 DbClient (com.emc.storageos.db.client.DbClient)24 ArrayList (java.util.ArrayList)18 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)11 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)9 StringSet (com.emc.storageos.db.client.model.StringSet)6 FileShare (com.emc.storageos.db.client.model.FileShare)4 HashMap (java.util.HashMap)4 DbClientImpl (com.emc.storageos.db.client.impl.DbClientImpl)3 FilePolicy (com.emc.storageos.db.client.model.FilePolicy)3 Volume (com.emc.storageos.db.client.model.Volume)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 Configuration (com.emc.storageos.coordinator.common.Configuration)2 FatalCoordinatorException (com.emc.storageos.coordinator.exceptions.FatalCoordinatorException)2 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 ExportMask (com.emc.storageos.db.client.model.ExportMask)2 FileReplicationTopology (com.emc.storageos.db.client.model.FileReplicationTopology)2 Initiator (com.emc.storageos.db.client.model.Initiator)2