Search in sources :

Example 1 with RPCGExportCompleter

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));
        }
    }
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) RPCGExportCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportCompleter) VolumeGroupUpdateTaskCompleter(com.emc.storageos.vplexcontroller.completers.VolumeGroupUpdateTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) VolumeVpoolChangeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeVpoolChangeTaskCompleter) RPCGProtectionTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGProtectionTaskCompleter) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 2 with RPCGExportCompleter

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));
        }
    }
}
Also used : Workflow(com.emc.storageos.workflow.Workflow) RPCGExportCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportCompleter) VolumeGroupUpdateTaskCompleter(com.emc.storageos.vplexcontroller.completers.VolumeGroupUpdateTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) VolumeVpoolChangeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeVpoolChangeTaskCompleter) RPCGProtectionTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGProtectionTaskCompleter) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) URISyntaxException(java.net.URISyntaxException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Aggregations

FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)2 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)2 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)2 ProtectionSystem (com.emc.storageos.db.client.model.ProtectionSystem)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 LockRetryException (com.emc.storageos.locking.LockRetryException)2 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)2 RPCGExportCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportCompleter)2 RPCGProtectionTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGProtectionTaskCompleter)2 VolumeVpoolChangeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeVpoolChangeTaskCompleter)2 VolumeGroupUpdateTaskCompleter (com.emc.storageos.vplexcontroller.completers.VolumeGroupUpdateTaskCompleter)2 Workflow (com.emc.storageos.workflow.Workflow)2 WorkflowException (com.emc.storageos.workflow.WorkflowException)2 URISyntaxException (java.net.URISyntaxException)2