use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method exportGroupCreate.
/*
* RPDeviceController.exportGroupCreate()
*
* This method is a mini-orchestration of all of the steps necessary to create an export based on
* a Bourne Snapshot object associated with a RecoverPoint bookmark.
*
* This controller does not service block devices for export, only RP bookmark snapshots.
*
* The method is responsible for performing the following steps:
* - Enable the volumes to a specific bookmark.
* - Call the block controller to export the target volume
*
* @param protectionDevice The RP System used to manage the protection
*
* @param exportgroupID The export group
*
* @param snapshots snapshot list
*
* @param initatorURIs initiators to send to the block controller
*
* @param token The task object
*/
@Override
public void exportGroupCreate(URI protectionDevice, URI exportGroupID, List<URI> initiatorURIs, Map<URI, Integer> snapshots, String token) throws ControllerException {
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 RPCGExportCompleter(exportGroupID, token);
// Ensure the bookmarks actually exist before creating the export group
searchForBookmarks(protectionDevice, snapshots.keySet());
// 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, "exportGroupCreate", true, newToken);
// Tasks 1: Activate the bookmarks
//
// Enable image access on the target volumes
addEnableImageAccessStep(workflow, rpSystem, snapshots, null);
// Tasks 2: Export Volumes
//
// Export the volumes associated with the snapshots to the host
addExportSnapshotSteps(workflow, rpSystem, exportGroupID, snapshots, initiatorURIs);
// Execute the plan and allow the WorkflowExecutor to fire the taskCompleter.
String successMessage = String.format("Workflow of Export Group %s 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.RPCGExportCompleter in project coprhd-controller by CoprHD.
the class RPDeviceController method exportGroupAddVolumes.
/*
* RPDeviceController.exportAddVolume()
*
* This method is a mini-orchestration of all of the steps necessary to add a volume to an export group
* that is based on a Bourne Snapshot object associated with a RecoverPoint bookmark.
*
* This controller does not service block devices for export, only RP bookmark snapshots.
*
* The method is responsible for performing the following steps:
* - Enable the volumes to a specific bookmark.
* - Call the block controller to export the target volume
*
* @param protectionDevice The RP System used to manage the protection
*
* @param exportGroupID The export group
*
* @param snapshot RP snapshot
*
* @param lun HLU
*
* @param token The task object associated with the volume creation task that we piggy-back our events on
*/
@Override
public void exportGroupAddVolumes(URI protectionDevice, URI exportGroupID, Map<URI, Integer> snapshots, 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 RPCGExportCompleter(exportGroupID, token);
// Ensure the bookmarks actually exist before creating the export group
searchForBookmarks(protectionDevice, snapshots.keySet());
// 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, "exportGroupAddVolume", true, newToken);
// Tasks 1: Activate the bookmark
//
// Enable image access on the target volume
addEnableImageAccessStep(workflow, rpSystem, snapshots, null);
// Tasks 2: Export Volumes
//
// Export the volumes associated with the snapshots to the host
addExportAddVolumeSteps(workflow, rpSystem, exportGroupID, snapshots);
// Execute the plan and allow the WorkflowExecutor to fire the taskCompleter.
String successMessage = String.format("Workflow of Export Group %s Add 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