use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportDeleteCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method exportGroupDelete.
/*
* RPDeviceController.exportGroupDelete()
*
* This method is a mini-orchestration of all of the steps necessary to delete an export group.
*
* This controller does not service block devices for export, only RP bookmark snapshots.
*
* The method is responsible for performing the following steps:
* - Call the block controller to delete the export of the target volumes
* - Disable the bookmarks associated with the snapshots.
*
* @param protectionDevice The RP System used to manage the protection
*
* @param exportgroupID The export group
*
* @param token The task object associated with the volume creation task that we piggy-back our events on
*/
@Override
public void exportGroupDelete(URI protectionDevice, URI exportGroupID, String token) throws InternalException {
TaskCompleter taskCompleter = null;
try {
// Grab the RP System information; we'll need it to talk to the RP client
ProtectionSystem rpSystem = getRPSystem(protectionDevice);
taskCompleter = new RPCGExportDeleteCompleter(exportGroupID, token);
// Create a new token/taskid and use that in the workflow. Multiple threads entering this method might
// collide with each others
// workflows in cassandra if the taskid is not unique.
String newToken = UUID.randomUUID().toString();
// Set up workflow steps.
Workflow workflow = _workflowService.getNewWorkflow(this, "exportGroupDelete", true, newToken);
// Task 1: deactivate the bookmarks
//
// Disable image access on the target volumes
// This is important to do first because:
// After the export group is deleted (in the next step), we may not have access to the object.
// If export delete itself were to fail, it's good that we at least got this step done. Easier to remediate.
addDisableImageAccessSteps(workflow, rpSystem, exportGroupID);
// Task 2: Export Delete Volumes
//
// Delete of the export group with the volumes associated with the snapshots to the host
addExportSnapshotDeleteSteps(workflow, rpSystem, exportGroupID);
// Execute the plan and allow the WorkflowExecutor to fire the taskCompleter.
String successMessage = String.format("Workflow of Export Group %s Delete successfully created", exportGroupID);
workflow.executePlan(taskCompleter, successMessage);
} catch (InternalException e) {
_log.error("Operation failed with Exception: ", e);
if (taskCompleter != null) {
taskCompleter.error(_dbClient, e);
}
} catch (Exception e) {
_log.error("Operation failed with Exception: ", e);
if (taskCompleter != null) {
taskCompleter.error(_dbClient, DeviceControllerException.errors.jobFailed(e));
}
}
}
use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportDeleteCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method exportGroupRemoveVolumes.
/**
* RPDeviceController.exportRemoveVolume()
*
* This method is a mini-orchestration of all of the steps necessary to remove an RP volume from an export group.
*
* This controller does not service block devices for export, only RP bookmark snapshots.
*
* The method is responsible for performing the following steps:
* - Call the block controller to delete the export of the target volume
* - Disable the bookmarks associated with the snapshot.
*
* @param protectionDevice
* The RP System used to manage the protection
* @param exportgroupID
* The export group
* @param snapshotID
* snapshot ID to remove
* @param token
* The task object
*/
@Override
public void exportGroupRemoveVolumes(URI protectionDevice, URI exportGroupID, List<URI> snapshotIDs, String token) throws InternalException {
TaskCompleter taskCompleter = null;
try {
// Grab the RP System information; we'll need it to talk to the RP client
ProtectionSystem rpSystem = getRPSystem(protectionDevice);
taskCompleter = new RPCGExportDeleteCompleter(exportGroupID, token);
// Create a new token/taskid and use that in the workflow. Multiple threads entering this method might
// collide with each others
// workflows in cassandra if the taskid is not unique.
String newToken = UUID.randomUUID().toString();
// Set up workflow steps.
Workflow workflow = _workflowService.getNewWorkflow(this, "exportRemoveVolume", true, newToken);
// Task 1: deactivate the bookmark
//
// Disable image access on the target volumes
// We want to run this first so we at least get the target volume freed-up, even if
// the export remove fails.
addDisableImageAccessSteps(workflow, rpSystem, exportGroupID, snapshotIDs);
// Task 2: Export Volume removal
//
// Export the volumes associated with the snapshots to the host
addExportRemoveVolumeSteps(workflow, rpSystem, exportGroupID, snapshotIDs);
// Execute the plan and allow the WorkflowExecutor to fire the taskCompleter.
String successMessage = String.format("Workflow of Export Group %s Remove Volume successfully created", exportGroupID);
workflow.executePlan(taskCompleter, successMessage);
} catch (InternalException e) {
_log.error("Operation failed with Exception: ", e);
if (taskCompleter != null) {
taskCompleter.error(_dbClient, e);
}
} catch (Exception e) {
_log.error("Operation failed with Exception: ", e);
if (taskCompleter != null) {
taskCompleter.error(_dbClient, DeviceControllerException.errors.jobFailed(e));
}
}
}
Aggregations