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