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);
}
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);
}
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);
}
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");
}
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");
}
Aggregations