use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method detachDataCenterStorage.
@Override
public void detachDataCenterStorage(URI datacenter, boolean deactivateOnComplete, String taskId) throws InternalException {
TaskCompleter completer = null;
try {
completer = new VcenterDataCenterCompleter(datacenter, deactivateOnComplete, taskId);
Workflow workflow = _workflowService.getNewWorkflow(this, DETACH_VCENTER_DATACENTER_STORAGE_WF_NAME, true, taskId);
String waitFor = null;
waitFor = addStepForVcenterDataCenter(workflow, waitFor, datacenter);
workflow.executePlan(completer, "Success", null, null, null, null);
} catch (Exception ex) {
String message = "detachDataCenterStorage caught an exception.";
_log.error(message, ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method addInitiatorsToExport.
@Override
public void addInitiatorsToExport(URI eventId, URI hostId, List<URI> initiators, String taskId) throws ControllerException {
TaskCompleter completer = null;
try {
completer = new InitiatorCompleter(eventId, initiators, InitiatorOperation.ADD, taskId);
Workflow workflow = _workflowService.getNewWorkflow(this, ADD_INITIATOR_STORAGE_WF_NAME, true, taskId);
String waitFor = null;
waitFor = addStepsForAddInitiators(workflow, waitFor, hostId, initiators, eventId);
workflow.executePlan(completer, "Success", null, null, null, null);
} catch (Exception ex) {
String message = "addInitiatorToStorage caught an exception.";
_log.error(message, ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class ComputeSystemControllerImpl method setHostBootVolume.
@Override
public void setHostBootVolume(URI host, URI bootVolumeId, boolean updateSanBootTargets, String taskId) throws ControllerException {
TaskCompleter completer = null;
try {
completer = new HostCompleter(host, false, taskId);
Workflow workflow = _workflowService.getNewWorkflow(this, SET_SAN_BOOT_TARGETS_WF_NAME, true, taskId);
String waitFor = addStepsForBootVolume(workflow, host, bootVolumeId);
if (updateSanBootTargets) {
waitFor = addStepsForSanBootTargets(workflow, host, bootVolumeId, waitFor);
}
workflow.executePlan(completer, "Success", null, null, null, null);
} catch (Exception ex) {
String message = "setHostSanBootTargets caught an exception.";
_log.error(message, ex);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
completer.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method createMirror.
/**
* {@inheritDoc} NOTE NOTE: The signature here MUST match the Workflow.Method createMirrorMethod just above (except
* opId).
*/
@Override
public void createMirror(URI storage, List<URI> mirrorList, Boolean isCG, Boolean createInactive, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
WorkflowStepCompleter.stepExecuting(opId);
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
if (!isCG && mirrorList.size() == 1) {
completer = new BlockMirrorCreateCompleter(mirrorList.get(0), opId);
getDevice(storageObj.getSystemType()).doCreateMirror(storageObj, mirrorList.get(0), createInactive, completer);
} else {
boolean isListReplicaFlow = false;
BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirrorList.get(0));
Volume sourceVolume = _dbClient.queryObject(Volume.class, mirrorObj.getSource().getURI());
/**
* VPLEX/RP CG volumes may not be having back end Array Group.
* In this case we should create element replica using createListReplica.
* We should not use createGroup replica as backend cg will not be available in this case.
*/
isListReplicaFlow = isListReplicaFlow(sourceVolume);
completer = new BlockMirrorCreateCompleter(mirrorList, opId);
if (!isListReplicaFlow) {
getDevice(storageObj.getSystemType()).doCreateGroupMirrors(storageObj, mirrorList, createInactive, completer);
} else {
// List Replica
getDevice(storageObj.getSystemType()).doCreateListReplica(storageObj, mirrorList, createInactive, completer);
}
}
} catch (Exception e) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
if (completer != null) {
completer.error(_dbClient, serviceError);
}
WorkflowStepCompleter.stepFailed(opId, serviceError);
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method relinkTargetsToSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void relinkTargetsToSnapshotSession(URI systemURI, URI tgtSnapSessionURI, List<URI> snapshotURIs, Boolean updateStatus, String opId) throws InternalException {
TaskCompleter completer = new BlockSnapshotSessionRelinkTargetsWorkflowCompleter(tgtSnapSessionURI, updateStatus, opId);
try {
// Get a new workflow to execute the linking of the target volumes
// to the new session.
Workflow workflow = _workflowService.getNewWorkflow(this, RELINK_SNAPSHOT_SESSION_TARGETS_WF_NAME, false, opId);
_log.info("Created new workflow to re-link targets to snapshot session {} with operation id {}", tgtSnapSessionURI, opId);
Iterable<URI> snapshotsIterable = snapshotURIs;
BlockSnapshotSession tgtSnapSession = _dbClient.queryObject(BlockSnapshotSession.class, tgtSnapSessionURI);
// For CG's, ensure 1 target per ReplicationGroup
if (tgtSnapSession.hasConsistencyGroup() && NullColumnValueGetter.isNotNullValue(tgtSnapSession.getReplicationGroupInstance())) {
snapshotsIterable = ControllerUtils.ensureOneSnapshotPerReplicationGroup(snapshotURIs, _dbClient);
}
String waitFor = null;
for (URI snapshotURI : snapshotsIterable) {
waitFor = workflow.createStep(RELINK_SNAPSHOT_SESSION_TARGET_STEP_GROUP, String.format("Re-linking target to snapshot session %s", tgtSnapSessionURI), waitFor, systemURI, getDeviceType(systemURI), getClass(), relinkBlockSnapshotSessionTargetMethod(systemURI, tgtSnapSessionURI, snapshotURI), null, null);
}
workflow.executePlan(completer, "Re-link target volumes to block snapshot session successful");
} catch (Exception e) {
_log.error("Re-link target volumes to block snapshot session failed", e);
ServiceCoded serviceException = DeviceControllerException.exceptions.relinkBlockSnapshotSessionTargetsFailed(e);
completer.error(_dbClient, serviceException);
}
}
Aggregations