Search in sources :

Example 76 with BlockMirror

use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.

the class BlockObjectSystemTypeMigrationTest method verifyResults.

@Override
protected void verifyResults() throws Exception {
    log.info("Verifying results of volume system type migration test now.");
    Map<URI, String> storageSystemTypeMap = new HashMap<URI, String>();
    List<URI> volumeUris = _dbClient.queryByType(Volume.class, true);
    Iterator<Volume> volumes = _dbClient.queryIterativeObjects(Volume.class, volumeUris, true);
    int vplexMigratedCount = 0;
    int vnxMigratedCount = 0;
    int vmaxMigratedCount = 0;
    int vmax3MigratedCount = 0;
    while (volumes.hasNext()) {
        Volume volume = volumes.next();
        String deviceSystemType = getDeviceSystemType(storageSystemTypeMap, volume);
        if (deviceSystemType != null && deviceSystemType.equalsIgnoreCase(volume.getSystemType())) {
            log.info("found block object system type {}", volume.getSystemType());
            switch(deviceSystemType) {
                case "vplex":
                    vplexMigratedCount++;
                    break;
                case "vnxblock":
                    vnxMigratedCount++;
                    break;
                case "vmax":
                    vmaxMigratedCount++;
                    break;
                case "vmax3":
                    vmax3MigratedCount++;
                    break;
                default:
                    log.error("unknown device system type {}", deviceSystemType);
                    break;
            }
        } else {
            log.error("volume {} found not migrated properly with system type {}", volume.forDisplay(), volume.getSystemType());
        }
    }
    int snapshotMigratedCount = 0;
    List<URI> snapshotUris = _dbClient.queryByType(BlockSnapshot.class, true);
    Iterator<BlockSnapshot> snapshots = _dbClient.queryIterativeObjects(BlockSnapshot.class, snapshotUris, true);
    while (snapshots.hasNext()) {
        BlockSnapshot snapshot = snapshots.next();
        String deviceSystemType = getDeviceSystemType(storageSystemTypeMap, snapshot);
        if (deviceSystemType != null && deviceSystemType.equalsIgnoreCase(snapshot.getSystemType())) {
            log.info("found block snapshot system type {}", snapshot.getSystemType());
            snapshotMigratedCount++;
        } else {
            log.error("snapshot {} found not migrated properly with system type {}", snapshot.forDisplay(), snapshot.getSystemType());
        }
    }
    int mirrorMigratedCount = 0;
    List<URI> mirrorUris = _dbClient.queryByType(BlockMirror.class, true);
    Iterator<BlockMirror> mirrors = _dbClient.queryIterativeObjects(BlockMirror.class, mirrorUris, true);
    while (mirrors.hasNext()) {
        BlockMirror mirror = mirrors.next();
        String deviceSystemType = getDeviceSystemType(storageSystemTypeMap, mirror);
        if (deviceSystemType != null && deviceSystemType.equalsIgnoreCase(mirror.getSystemType())) {
            log.info("found block mirror system type {}", mirror.getSystemType());
            mirrorMigratedCount++;
        } else {
            log.error("mirror {} found not migrated properly with system type {}", mirror.forDisplay(), mirror.getSystemType());
        }
    }
    log.info("vplexMigratedCount: " + vplexMigratedCount);
    log.info("vnxMigratedCount: " + vnxMigratedCount);
    log.info("vmaxMigratedCount: " + vmaxMigratedCount);
    log.info("vmax3MigratedCount: " + vmax3MigratedCount);
    log.info("snapshotMigratedCount: " + snapshotMigratedCount);
    log.info("mirrorMigratedCount: " + mirrorMigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VPLEX volumes.", VPLEX_VOLUME_COUNT), VPLEX_VOLUME_COUNT, vplexMigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VNX volumes.", VNX_VOLUME_COUNT), VNX_VOLUME_COUNT, vnxMigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VMAX volumes.", VMAX_VOLUME_COUNT), VMAX_VOLUME_COUNT, vmaxMigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VMAX3 volumes.", VMAX3_VOLUME_COUNT), VMAX3_VOLUME_COUNT, vmax3MigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VMAX3 snapshots.", SNAPSHOT_COUNT), SNAPSHOT_COUNT, snapshotMigratedCount);
    Assert.assertEquals(String.format("We should have found %d migrated VMAX3 mirrors.", MIRROR_COUNT), MIRROR_COUNT, mirrorMigratedCount);
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) HashMap(java.util.HashMap) Volume(com.emc.storageos.db.client.model.Volume) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) URI(java.net.URI)

Example 77 with BlockMirror

use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.

the class BlockObjectConsistencyGroupMigration method updateBlockMirrorConsistencyGroup.

/**
 * Update the BlockMirror object to migrate the old consistencyGroup field
 * into the new consistencyGroup list field.
 */
private void updateBlockMirrorConsistencyGroup() {
    log.info("Migrating BlockMirror consistencyGroup to consistencyGroups.");
    DbClient dbClient = getDbClient();
    List<URI> blockMirrorURIs = dbClient.queryByType(BlockMirror.class, false);
    Iterator<BlockMirror> blockMirrors = dbClient.queryIterativeObjects(BlockMirror.class, blockMirrorURIs);
    List<BlockObject> blockObjects = new ArrayList<BlockObject>();
    while (blockMirrors.hasNext()) {
        blockObjects.add(blockMirrors.next());
    }
    migrate(blockObjects);
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) ArrayList(java.util.ArrayList) URI(java.net.URI) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Example 78 with BlockMirror

use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.

the class BlockObjectMultipleConsistencyGroupsMigration method migrateBlockMirrors.

/**
 * Update the BlockMirror object to migrate the old consistencyGroups field
 * into the new consistencyGroup list field.
 */
private void migrateBlockMirrors() {
    log.info("Migrating BlockConsistencyGroup references on BlockMirror objects.");
    DbClient dbClient = getDbClient();
    List<URI> blockMirrorURIs = dbClient.queryByType(BlockMirror.class, false);
    Iterator<BlockMirror> blockMirrors = dbClient.queryIterativeObjects(BlockMirror.class, blockMirrorURIs, true);
    List<BlockObject> blockObjects = new ArrayList<BlockObject>();
    while (blockMirrors.hasNext()) {
        blockObjects.add(blockMirrors.next());
    }
    migrateBlockObjects(blockObjects);
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) ArrayList(java.util.ArrayList) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) BlockObject(com.emc.storageos.db.client.model.BlockObject)

Example 79 with BlockMirror

use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.

the class HDSMirrorOperations method resumeSingleVolumeMirror.

/**
 * Resync ShadowImage pair
 */
@Override
public void resumeSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("resumeSingleVolumeMirror started");
    try {
        BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirror);
        Volume sourceVolume = dbClient.queryObject(Volume.class, mirrorObj.getSource());
        hdsProtectionOperations.modifyShadowImagePair(storage, sourceVolume.getNativeId(), mirrorObj.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.resync);
        HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), sourceVolume.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.PAIR, taskCompleter);
        hdsCommandHelper.waitForAsyncHDSJob(syncjob);
        mirrorObj.setSyncState(SynchronizationState.SYNCHRONIZED.name());
        dbClient.persistObject(mirrorObj);
        taskCompleter.ready(dbClient);
    } catch (Exception e) {
        log.error("Failed to resume single volume mirror: {}", mirror, e);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
        taskCompleter.error(dbClient, serviceError);
    }
    log.info("resumeSingleVolumeMirror completed");
}
Also used : HDSReplicationSyncJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) HDSJob(com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSJob) Volume(com.emc.storageos.db.client.model.Volume) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Example 80 with BlockMirror

use of com.emc.storageos.db.client.model.BlockMirror in project coprhd-controller by CoprHD.

the class HDSMirrorOperations method createSingleVolumeMirror.

/**
 * 1. Find ReplicationGroup objId from Device Manager
 * 2. Check dummy Host Group available on Storage System. if not available create a dummy Host Group name.
 * 3. Create a secondary volume and add dummy host group on it.
 * 4. create a SI pair.
 *
 * @param storageSystem {@link StorageSystem}
 * @param mirrorVolumeURI {@link URI}
 * @param createInactive {@link Boolean}
 * @param taskCompleter {@link TaskCompleter}
 */
@Override
public void createSingleVolumeMirror(StorageSystem storageSystem, URI mirrorVolumeURI, Boolean createInactive, TaskCompleter taskCompleter) throws DeviceControllerException {
    log.info("START createSingleVolumeMirror operation");
    try {
        HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageSystem), storageSystem.getSmisUserName(), storageSystem.getSmisPassword());
        HDSApiProtectionManager hdsApiProtectionManager = hdsApiClient.getHdsApiProtectionManager();
        String replicationGroupObjectID = hdsApiClient.getHdsApiProtectionManager().getReplicationGroupObjectId();
        if (replicationGroupObjectID == null) {
            log.error("Unable to find replication group information/pair management server for pair configuration");
            throw HDSException.exceptions.replicationGroupNotAvailable();
        }
        BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirrorVolumeURI);
        Volume source = dbClient.queryObject(Volume.class, mirrorObj.getSource());
        hdsProtectionOperations.createSecondaryVolumeForMirror(storageSystem, source.getId(), mirrorObj);
        mirrorObj = dbClient.queryObject(BlockMirror.class, mirrorVolumeURI);
        hdsProtectionOperations.addDummyLunPath(hdsApiClient, mirrorObj);
        String pairName = hdsProtectionOperations.generatePairName(source, mirrorObj);
        log.info("Pair Name :{}", pairName);
        ReplicationInfo replicationInfo = hdsApiProtectionManager.createShadowImagePair(replicationGroupObjectID, pairName, HDSUtils.getSystemArrayType(storageSystem), HDSUtils.getSystemSerialNumber(storageSystem), source.getNativeId(), mirrorObj.getNativeId(), storageSystem.getModel());
        mirrorObj.setSyncState(SynchronizationState.SYNCHRONIZED.name());
        dbClient.persistObject(mirrorObj);
        log.info("Replication Info object :{}", replicationInfo.toXMLString());
        taskCompleter.ready(dbClient);
    } catch (Exception e) {
        String errorMsg = String.format(CREATE_ERROR_MSG_FORMAT, mirrorVolumeURI);
        log.error(errorMsg, e);
        ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("createSingleVolumeMirror", e.getMessage());
        taskCompleter.error(dbClient, serviceError);
    }
    log.info("FINISHED createSingleVolumeMirror operation");
}
Also used : HDSApiClient(com.emc.storageos.hds.api.HDSApiClient) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockMirror(com.emc.storageos.db.client.model.BlockMirror) Volume(com.emc.storageos.db.client.model.Volume) HDSApiProtectionManager(com.emc.storageos.hds.api.HDSApiProtectionManager) ReplicationInfo(com.emc.storageos.hds.model.ReplicationInfo) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) HDSException(com.emc.storageos.hds.HDSException)

Aggregations

BlockMirror (com.emc.storageos.db.client.model.BlockMirror)115 Volume (com.emc.storageos.db.client.model.Volume)77 URI (java.net.URI)49 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)43 ArrayList (java.util.ArrayList)33 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)30 NamedURI (com.emc.storageos.db.client.model.NamedURI)29 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)28 CIMObjectPath (javax.cim.CIMObjectPath)26 CIMInstance (javax.cim.CIMInstance)16 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)15 FCTN_MIRROR_TO_URI (com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_MIRROR_TO_URI)15 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)15 CIMArgument (javax.cim.CIMArgument)14 WBEMException (javax.wbem.WBEMException)14 BlockObject (com.emc.storageos.db.client.model.BlockObject)12 StringSet (com.emc.storageos.db.client.model.StringSet)12 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 ControllerException (com.emc.storageos.volumecontroller.ControllerException)10 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)9