use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.
the class HDSMirrorOperations method detachSingleVolumeMirror.
/**
* 1. Delete ShadowImage Pair
* 2. Delete DummyLunPath from secondary volume
*/
@Override
public void detachSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
NamedURI sourceVolumeURI = null;
try {
BlockMirror mirrorObj = dbClient.queryObject(BlockMirror.class, mirror);
// TODO needs to sync pair and wait for synchronization here
Volume source = dbClient.queryObject(Volume.class, mirrorObj.getSource());
sourceVolumeURI = mirrorObj.getSource();
boolean status = hdsProtectionOperations.modifyShadowImagePair(storage, source.getNativeId(), mirrorObj.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.split);
if (status) {
String taskId = UUID.randomUUID().toString();
TaskCompleter completer = new SimpleTaskCompleter(BlockMirror.class, mirror, taskId);
HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), source.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.SPLIT, completer);
hdsCommandHelper.waitForAsyncHDSJob(syncjob);
} else {
log.info("Replication info is not available on pair management server");
}
hdsProtectionOperations.deleteShadowImagePair(storage, source, mirrorObj);
hdsProtectionOperations.removeDummyLunPath(storage, mirror);
taskCompleter.ready(dbClient);
} catch (Exception e) {
String errorMsg = String.format(DETACH_ERROR_MSG_FORMAT, mirror, sourceVolumeURI != null ? sourceVolumeURI.toString() : HDSConstants.SPACE_STR);
log.error(errorMsg, e);
ServiceError serviceError = DeviceControllerErrors.hds.methodFailed("detachSingleVolumeMirror", e.getMessage());
taskCompleter.error(dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.
the class HDSCloneOperations method restoreFromSingleClone.
@Override
public void restoreFromSingleClone(StorageSystem storageSystem, URI cloneURI, TaskCompleter taskCompleter) {
try {
Volume cloneVolume = dbClient.queryObject(Volume.class, cloneURI);
Volume sourceVolume = dbClient.queryObject(Volume.class, cloneVolume.getAssociatedSourceVolume());
hdsProtectionOperations.modifyShadowImagePair(storageSystem, sourceVolume.getNativeId(), cloneVolume.getNativeId(), HDSApiProtectionManager.ShadowImageOperationType.restore);
ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageSystem.getId(), sourceVolume.getNativeId(), cloneVolume.getNativeId(), ReplicationStatus.PAIR, taskCompleter)));
log.info("FINISH restoreFromSingleClone for {}", cloneURI);
} catch (Exception e) {
String errorMsg = String.format(RESTORE_ERROR_MSG_FORMAT, cloneURI);
log.error(errorMsg, e);
taskCompleter.error(dbClient, DeviceControllerException.exceptions.activateVolumeFullCopyFailed(e));
}
}
use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.
the class HDSStorageDevice method doWaitForSynchronized.
/*
* (non-Javadoc)
*
* @see
* com.emc.storageos.volumecontroller.BlockStorageDevice#doWaitForSynchronized
* (java.lang.Class, com.emc.storageos.db.client.model.StorageSystem,
* java.net.URI, com.emc.storageos.volumecontroller.TaskCompleter)
*/
@Override
public void doWaitForSynchronized(Class<? extends BlockObject> clazz, StorageSystem storageObj, URI target, TaskCompleter completer) {
log.info("START waitForSynchronized for {}", target);
try {
Volume targetObj = dbClient.queryObject(Volume.class, target);
// Source could be either Volume or BlockSnapshot
BlockObject sourceObj = BlockObject.fetch(dbClient, targetObj.getAssociatedSourceVolume());
// We split the pair which causes the data to be synchronized.
// When the split is complete that data is synchronized.
HDSApiClient hdsApiClient = hdsApiFactory.getClient(HDSUtils.getHDSServerManagementServerInfo(storageObj), storageObj.getSmisUserName(), storageObj.getSmisPassword());
HDSApiProtectionManager hdsApiProtectionManager = hdsApiClient.getHdsApiProtectionManager();
String replicationGroupObjectID = hdsApiProtectionManager.getReplicationGroupObjectId();
ReplicationInfo replicationInfo = hdsApiProtectionManager.getReplicationInfoFromSystem(sourceObj.getNativeId(), targetObj.getNativeId()).first;
hdsApiProtectionManager.modifyShadowImagePair(replicationGroupObjectID, replicationInfo.getObjectID(), HDSApiProtectionManager.ShadowImageOperationType.split, storageObj.getModel());
// Update state in case we are waiting for synchronization
// after creation of a new full copy that was not created
// inactive.
String state = targetObj.getReplicaState();
if (!ReplicationState.SYNCHRONIZED.name().equals(state)) {
targetObj.setSyncActive(true);
targetObj.setReplicaState(ReplicationState.SYNCHRONIZED.name());
dbClient.persistObject(targetObj);
}
// Queue job to wait for replication status to move to split.
ControllerServiceImpl.enqueueJob(new QueueJob(new HDSReplicationSyncJob(storageObj.getId(), sourceObj.getNativeId(), targetObj.getNativeId(), ReplicationStatus.SPLIT, completer)));
} catch (Exception e) {
log.error("Exception occurred while waiting for synchronization", e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(dbClient, serviceError);
}
log.info("completed doWaitForSynchronized");
}
use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob in project coprhd-controller by CoprHD.
the class HDSMirrorOperations method fractureSingleVolumeMirror.
/**
* Split ShadowImage pair
*/
@Override
public void fractureSingleVolumeMirror(StorageSystem storage, URI mirror, Boolean sync, TaskCompleter taskCompleter) throws DeviceControllerException {
log.info("fractureSingleVolumeMirror 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.split);
HDSJob syncjob = new HDSReplicationSyncJob(storage.getId(), sourceVolume.getNativeId(), mirrorObj.getNativeId(), ReplicationStatus.SPLIT, taskCompleter);
hdsCommandHelper.waitForAsyncHDSJob(syncjob);
mirrorObj.setSyncState(SynchronizationState.FRACTURED.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("fractureSingleVolumeMirror completed");
}
use of com.emc.storageos.volumecontroller.impl.hds.prov.job.HDSReplicationSyncJob 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");
}
Aggregations