Search in sources :

Example 1 with FileDeleteWorkflowCompleter

use of com.emc.storageos.volumecontroller.impl.file.FileDeleteWorkflowCompleter in project coprhd-controller by CoprHD.

the class FileOrchestrationDeviceController method deleteFileSystems.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController#deleteFileSystems(java.util.List,
     * java.lang.String)
     */
/**
 * Deletes one or more filesystem.
 *
 * @param fileDescriptors
 * @param taskId
 * @throws ControllerException
 */
@Override
public void deleteFileSystems(List<FileDescriptor> fileDescriptors, String taskId) throws ControllerException {
    List<URI> fileShareUris = FileDescriptor.getFileSystemURIs(fileDescriptors);
    FileDeleteWorkflowCompleter completer = new FileDeleteWorkflowCompleter(fileShareUris, taskId);
    Workflow workflow = null;
    try {
        // Generate the Workflow.
        workflow = _workflowService.getNewWorkflow(this, DELETE_FILESYSTEMS_WF_NAME, false, taskId);
        // call the FileDeviceController to add its delete methods.
        _fileDeviceController.addStepsForDeleteFileSystems(workflow, null, fileDescriptors, taskId);
        // Finish up and execute the plan.
        // The Workflow will handle the TaskCompleter
        String successMessage = "Delete FileShares successful for: " + fileShareUris.toString();
        Object[] callbackArgs = new Object[] { fileShareUris };
        workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
    } catch (Exception ex) {
        s_logger.error("Could not delete FileShares: " + fileShareUris, ex);
        releaseWorkflowLocks(workflow);
        String opName = ResourceOperationTypeEnum.DELETE_FILE_SYSTEM.getName();
        ServiceError serviceError = DeviceControllerException.errors.deleteFileSharesFailed(fileShareUris.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileDeleteWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileDeleteWorkflowCompleter) Workflow(com.emc.storageos.workflow.Workflow) FileObject(com.emc.storageos.db.client.model.FileObject) URI(java.net.URI) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Aggregations

FileObject (com.emc.storageos.db.client.model.FileObject)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 FileDeleteWorkflowCompleter (com.emc.storageos.volumecontroller.impl.file.FileDeleteWorkflowCompleter)1 Workflow (com.emc.storageos.workflow.Workflow)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 URI (java.net.URI)1