use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotSessionLinkTargetsWorkflowCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method linkNewTargetVolumesToSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void linkNewTargetVolumesToSnapshotSession(URI systemURI, URI snapSessionURI, List<List<URI>> snapshotURIs, String copyMode, String opId) throws InternalException {
TaskCompleter completer = new BlockSnapshotSessionLinkTargetsWorkflowCompleter(snapSessionURI, snapshotURIs, opId);
try {
// Get a new workflow to execute the linking of the target volumes
// to the new session.
Workflow workflow = _workflowService.getNewWorkflow(this, LINK_SNAPSHOT_SESSION_TARGETS_WF_NAME, false, opId);
_log.info("Created new workflow to create and link new targets for snapshot session {} with operation id {}", snapSessionURI, opId);
if (checkSnapshotSessionConsistencyGroup(snapSessionURI, _dbClient, completer)) {
String waitFor = null;
for (List<URI> snapshotURI : snapshotURIs) {
waitFor = workflow.createStep(LINK_SNAPSHOT_SESSION_TARGET_STEP_GROUP, String.format("Linking target for snapshot session %s", snapSessionURI), waitFor, systemURI, getDeviceType(systemURI), getClass(), linkBlockSnapshotSessionTargetGroupMethod(systemURI, snapSessionURI, snapshotURI, copyMode, Boolean.FALSE), null, null);
}
} else {
for (List<URI> snapshotURI : snapshotURIs) {
workflow.createStep(LINK_SNAPSHOT_SESSION_TARGET_STEP_GROUP, String.format("Linking target for snapshot session %s", snapSessionURI), null, systemURI, getDeviceType(systemURI), getClass(), linkBlockSnapshotSessionTargetMethod(systemURI, snapSessionURI, snapshotURI.get(0), copyMode, Boolean.FALSE), rollbackLinkBlockSnapshotSessionTargetMethod(systemURI, snapSessionURI, snapshotURI.get(0)), null);
}
}
workflow.executePlan(completer, "Create and link new target volumes for block snapshot session successful");
} catch (Exception e) {
_log.error("Create and link new target volumes for block snapshot session failed", e);
ServiceCoded serviceException = DeviceControllerException.exceptions.linkBlockSnapshotSessionTargetsFailed(e);
completer.error(_dbClient, serviceException);
}
}
Aggregations