use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method fractureClone.
public boolean fractureClone(URI storage, List<URI> clone, boolean isCG, String opId) {
_log.info("Fracture clone: {}", clone.get(0));
TaskCompleter completer = null;
try {
StorageSystem storageDevice = _dbClient.queryObject(StorageSystem.class, storage);
WorkflowStepCompleter.stepExecuting(opId);
if (!isCG) {
Volume cloneVol = _dbClient.queryObject(Volume.class, clone.get(0));
completer = new CloneFractureCompleter(clone.get(0), opId);
WorkflowStepCompleter.stepExecuting(opId);
// Synchronous operation
getDevice(storageDevice.getSystemType()).doFractureClone(storageDevice, cloneVol.getAssociatedSourceVolume(), clone.get(0), completer);
} else {
_log.info("Fracture group clone.");
completer = new CloneFractureCompleter(clone, opId);
WorkflowStepCompleter.stepExecuting(opId);
// Synchronous operation
getDevice(storageDevice.getSystemType()).doFractureGroupClone(storageDevice, clone, completer);
}
} catch (Exception e) {
_log.error(String.format("Fracture restore sessions step failed - storage: %s, clone: %s", storage.toString(), clone.toString()));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
if (completer != null) {
completer.error(_dbClient, serviceError);
}
doFailTask(Volume.class, clone, opId, serviceError);
WorkflowStepCompleter.stepFailed(opId, serviceError);
return false;
}
return true;
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method createSingleSnapshot.
@Override
public void createSingleSnapshot(URI storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, String opId) throws ControllerException {
WorkflowStepCompleter.stepExecuting(opId);
TaskCompleter completer = null;
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
completer = new BlockSnapshotCreateCompleter(snapshotList, opId);
getDevice(storageObj.getSystemType()).doCreateSingleSnapshot(storageObj, snapshotList, createInactive, readOnly, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
WorkflowStepCompleter.stepFailed(opId, serviceError);
completer.error(_dbClient, serviceError);
} else {
throw DeviceControllerException.exceptions.createVolumeSnapshotFailed(e);
}
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteConsistencyGroup.
@Override
public void deleteConsistencyGroup(URI storage, URI consistencyGroup, Boolean markInactive, String opId) throws ControllerException {
_log.info("START delete consistency group");
TaskCompleter wfCompleter = null;
try {
Workflow workflow = _workflowService.getNewWorkflow(this, "deleteReplicationGroupInConsistencyGroup", true, opId);
wfCompleter = new SimpleTaskCompleter(BlockConsistencyGroup.class, consistencyGroup, opId);
StorageSystem system = _dbClient.queryObject(StorageSystem.class, storage);
BlockConsistencyGroup cg = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
Set<String> groupNames = BlockConsistencyGroupUtils.getGroupNamesForSystemCG(cg, system);
String stepId = null;
for (String groupName : groupNames) {
Workflow.Method deleteStep = new Workflow.Method("deleteReplicationGroupInConsistencyGroup", storage, consistencyGroup, groupName, false, markInactive, true);
stepId = workflow.createStep("DeleteReplicationGroup", "Deleting replication group", stepId, storage, system.getSystemType(), this.getClass(), deleteStep, rollbackMethodNullMethod(), null);
}
String successMsg = String.format("Successfully deleted replication groups %s", Joiner.on(',').join(groupNames));
workflow.executePlan(wfCompleter, successMsg);
} catch (Exception e) {
if (wfCompleter != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
wfCompleter.error(_dbClient, serviceError);
}
throw DeviceControllerException.exceptions.deleteConsistencyGroupFailed(e);
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method activateSnapshot.
@Override
public void activateSnapshot(URI storage, List<URI> snapshotList, String opId) throws ControllerException {
TaskCompleter completer = null;
try {
StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
completer = new BlockSnapshotActivateCompleter(snapshotList, opId);
getDevice(storageObj.getSystemType()).doActivateSnapshot(storageObj, snapshotList, completer);
} catch (Exception e) {
if (completer != null) {
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
} else {
throw DeviceControllerException.exceptions.activateVolumeSnapshotFailed(e);
}
}
}
use of com.emc.storageos.volumecontroller.TaskCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method activateFullCopy.
@Override
public void activateFullCopy(URI storage, List<URI> fullCopy, String opId) {
TaskCompleter completer = new CloneWorkflowCompleter(fullCopy, opId);
try {
// need to create a workflow to wait sync finish, then do fracture/activate
Workflow workflow = _workflowService.getNewWorkflow(this, ACTIVATE_CLONE_WF_NAME, false, opId);
_log.info("Created new activate workflow with operation id {}", opId);
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storage);
// add CG to taskCompleter
boolean isCG = checkCloneConsistencyGroup(fullCopy.get(0), _dbClient, completer);
if (storageSystem.deviceIsType(Type.vnxblock)) {
String previousStep = null;
if (isCG) {
for (URI cloneUri : fullCopy) {
Workflow.Method waitForSyncMethod = waitForSynchronizedMethod(Volume.class, storage, Arrays.asList(cloneUri), false);
String waitForSyncStep = workflow.createStep(FULL_COPY_WFS_STEP_GROUP, "Waiting for synchronization", previousStep, storage, storageSystem.getSystemType(), getClass(), waitForSyncMethod, null, null);
previousStep = waitForSyncStep;
}
} else {
Workflow.Method waitForSyncMethod = waitForSynchronizedMethod(Volume.class, storage, fullCopy, isCG);
String waitForSyncStep = workflow.createStep(FULL_COPY_WFS_STEP_GROUP, "Waiting for synchronization", previousStep, storage, storageSystem.getSystemType(), getClass(), waitForSyncMethod, null, null);
previousStep = waitForSyncStep;
}
workflow.createStep(ACTIVATE_CLONE_GROUP, "Activating clone", previousStep, storage, getDeviceType(storage), BlockDeviceController.class, activateCloneMethod(storage, fullCopy), rollbackMethodNullMethod(), null);
} else {
workflow.createStep(ACTIVATE_CLONE_GROUP, "Activating clone", null, storage, getDeviceType(storage), BlockDeviceController.class, activateCloneMethod(storage, fullCopy), rollbackMethodNullMethod(), null);
}
_log.info("Executing Activate workflow");
String msg = String.format("Actitvate %s completed successfully", fullCopy.get(0));
workflow.executePlan(completer, msg);
} catch (Exception e) {
String msg = String.format("Could not activate the clone %s", fullCopy.get(0));
_log.error(msg, e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
completer.error(_dbClient, serviceError);
}
}
Aggregations