Search in sources :

Example 61 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class BlockOrchestrationDeviceController method expandVolume.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.blockorchestrationcontroller.BlockOrchestrationController#expandVolume(java.net.URI, long,
     * java.lang.String)
     */
@Override
public void expandVolume(List<VolumeDescriptor> volumes, String taskId) throws ControllerException {
    List<URI> volUris = VolumeDescriptor.getVolumeURIs(volumes);
    VolumeWorkflowCompleter completer = new VolumeWorkflowCompleter(volUris, taskId);
    try {
        // Validate the volume identities before proceeding
        validator.volumeURIs(volUris, true, true, ValCk.ID, ValCk.VPLEX);
        // Generate the Workflow.
        Workflow workflow = _workflowService.getNewWorkflow(this, EXPAND_VOLUMES_WF_NAME, true, taskId);
        // the wait for key returned by previous call
        String waitFor = null;
        // First, call the RP controller to add methods for RP CG delete
        waitFor = _rpDeviceController.addPreVolumeExpandSteps(workflow, volumes, taskId);
        // Call the BlockDeviceController to add its methods if there are block or VPLEX backend volumes.
        waitFor = _blockDeviceController.addStepsForExpandVolume(workflow, waitFor, volumes, taskId);
        // Call the SRDFDeviceController to add its methods for SRDF Source / SRDF Target volumes.
        waitFor = _srdfDeviceController.addStepsForExpandVolume(workflow, waitFor, volumes, taskId);
        // Call the VPlexDeviceController to add its methods if there are VPLEX volumes.
        waitFor = _vplexDeviceController.addStepsForExpandVolume(workflow, waitFor, volumes, taskId);
        // Call the RPDeviceController to add its methods for post volume expand ie. recreate RPCG
        waitFor = _rpDeviceController.addPostVolumeExpandSteps(workflow, waitFor, volumes, taskId);
        // Finish up and execute the plan.
        // The Workflow will handle the TaskCompleter
        String successMessage = "Expand volume successful for: " + volUris.toString();
        Object[] callbackArgs = new Object[] { new ArrayList<URI>(volUris) };
        workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
    } catch (Exception ex) {
        s_logger.error("Could not expand volume: " + volUris, toString(), ex);
        String opName = ResourceOperationTypeEnum.EXPAND_BLOCK_VOLUME.getName();
        ServiceError serviceError = DeviceControllerException.errors.expandVolumeFailed(volUris.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) VolumeWorkflowCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.VolumeWorkflowCompleter) ArrayList(java.util.ArrayList) Workflow(com.emc.storageos.workflow.Workflow) BlockObject(com.emc.storageos.db.client.model.BlockObject) URI(java.net.URI) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException)

Example 62 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method detachClusterStorage.

@Override
public void detachClusterStorage(URI cluster, boolean deactivateOnComplete, boolean checkVms, String taskId) throws InternalException {
    TaskCompleter completer = null;
    try {
        completer = new ClusterCompleter(cluster, deactivateOnComplete, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, DETACH_CLUSTER_STORAGE_WF_NAME, true, taskId);
        String waitFor = null;
        if (checkVms) {
            waitFor = computeDeviceController.addStepsVcenterClusterCleanup(workflow, waitFor, cluster, deactivateOnComplete);
        }
        waitFor = unmountClusterStorage(workflow, waitFor, cluster);
        waitFor = addStepsForClusterExportGroups(workflow, waitFor, cluster);
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "detachClusterStorage caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 63 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method detachDataCenterStorage.

@Override
public void detachDataCenterStorage(URI datacenter, boolean deactivateOnComplete, String taskId) throws InternalException {
    TaskCompleter completer = null;
    try {
        completer = new VcenterDataCenterCompleter(datacenter, deactivateOnComplete, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, DETACH_VCENTER_DATACENTER_STORAGE_WF_NAME, true, taskId);
        String waitFor = null;
        waitFor = addStepForVcenterDataCenter(workflow, waitFor, datacenter);
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "detachDataCenterStorage caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 64 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method addInitiatorsToExport.

@Override
public void addInitiatorsToExport(URI eventId, URI hostId, List<URI> initiators, String taskId) throws ControllerException {
    TaskCompleter completer = null;
    try {
        completer = new InitiatorCompleter(eventId, initiators, InitiatorOperation.ADD, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, ADD_INITIATOR_STORAGE_WF_NAME, true, taskId);
        String waitFor = null;
        waitFor = addStepsForAddInitiators(workflow, waitFor, hostId, initiators, eventId);
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "addInitiatorToStorage caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) ExportTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Example 65 with Workflow

use of com.emc.storageos.workflow.Workflow in project coprhd-controller by CoprHD.

the class ComputeSystemControllerImpl method removeHostsFromExport.

@Override
public void removeHostsFromExport(URI eventId, List<URI> hostIds, URI clusterId, boolean isVcenter, URI vCenterDataCenterId, String taskId) throws ControllerException {
    HostCompleter completer = null;
    try {
        completer = new HostCompleter(eventId, hostIds, false, taskId);
        Workflow workflow = _workflowService.getNewWorkflow(this, REMOVE_HOST_STORAGE_WF_NAME, true, taskId);
        String waitFor = null;
        waitFor = addStepsForRemoveHost(workflow, waitFor, hostIds, clusterId, vCenterDataCenterId, isVcenter);
        // Pass a null completer so if an error occurs we do not change the host/initiator cluster value or host
        // vcenterdatacenter value.
        waitFor = addStepForUpdatingHostAndInitiatorClusterReferences(workflow, waitFor, hostIds, NullColumnValueGetter.getNullURI(), vCenterDataCenterId, null);
        workflow.executePlan(completer, "Success", null, null, null, null);
    } catch (Exception ex) {
        String message = "removeHostFromExport caught an exception.";
        _log.error(message, ex);
        ServiceError serviceError = DeviceControllerException.errors.jobFailed(ex);
        completer.error(_dbClient, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) Workflow(com.emc.storageos.workflow.Workflow) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) ControllerException(com.emc.storageos.volumecontroller.ControllerException) ComputeSystemControllerException(com.emc.storageos.computesystemcontroller.exceptions.ComputeSystemControllerException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) WorkflowException(com.emc.storageos.workflow.WorkflowException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) RemoteException(java.rmi.RemoteException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) ClientControllerException(com.emc.storageos.exceptions.ClientControllerException)

Aggregations

Workflow (com.emc.storageos.workflow.Workflow)285 URI (java.net.URI)204 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)171 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)127 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)126 ControllerException (com.emc.storageos.volumecontroller.ControllerException)126 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)124 ArrayList (java.util.ArrayList)123 WorkflowException (com.emc.storageos.workflow.WorkflowException)119 NamedURI (com.emc.storageos.db.client.model.NamedURI)102 Volume (com.emc.storageos.db.client.model.Volume)76 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)72 HashMap (java.util.HashMap)66 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)65 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)61 ExportMask (com.emc.storageos.db.client.model.ExportMask)54 ExportTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportTaskCompleter)54 List (java.util.List)54 BlockObject (com.emc.storageos.db.client.model.BlockObject)41 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)41