use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.BlockSnapshotSessionDeleteWorkflowCompleter in project coprhd-controller by CoprHD.
the class BlockDeviceController method deleteSnapshotSession.
/**
* {@inheritDoc}
*/
@Override
public void deleteSnapshotSession(URI systemURI, URI snapSessionURI, String opId) {
TaskCompleter completer = new BlockSnapshotSessionDeleteWorkflowCompleter(snapSessionURI, opId);
try {
// Get a new workflow delete the snapshot session.
Workflow workflow = _workflowService.getNewWorkflow(this, DELETE_SNAPSHOT_SESSION_WF_NAME, false, opId);
_log.info("Created new workflow to delete snapshot session {} with operation id {}", snapSessionURI, opId);
// When deleting a group snapshot we need the name of the group.
String groupName = null;
boolean isCG = checkSnapshotSessionConsistencyGroup(snapSessionURI, _dbClient, completer);
if (isCG) {
BlockSnapshotSession snapSession = _dbClient.queryObject(BlockSnapshotSession.class, snapSessionURI);
groupName = snapSession.getReplicationGroupInstance();
}
// Create the workflow step to delete the snapshot session.
workflow.createStep(DELETE_SNAPSHOT_SESSION_STEP_GROUP, String.format("Delete snapshot session %s", snapSessionURI), null, systemURI, getDeviceType(systemURI), getClass(), deleteBlockSnapshotSessionMethod(systemURI, snapSessionURI, groupName, Boolean.FALSE), null, null);
// Execute the workflow.
workflow.executePlan(completer, "Delete block snapshot session successful");
} catch (Exception e) {
_log.error("Delete block snapshot session failed", e);
ServiceCoded serviceException = DeviceControllerException.exceptions.deleteBlockSnapshotSessionFailed(e);
completer.error(_dbClient, serviceException);
}
}
Aggregations