Search in sources :

Example 1 with RPCGExportDeleteCompleter

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));
        }
    }
}
Also used : RPCGExportDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportDeleteCompleter) Workflow(com.emc.storageos.workflow.Workflow) 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 RPCGExportDeleteCompleter

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));
        }
    }
}
Also used : RPCGExportDeleteCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportDeleteCompleter) Workflow(com.emc.storageos.workflow.Workflow) 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 RPCGExportDeleteCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.RPCGExportDeleteCompleter)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