Search in sources :

Example 1 with FileCreateWorkflowCompleter

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

the class FileOrchestrationDeviceController method createFileSystems.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController#createFileSystems(java.util.List,
     * java.lang.String)
     */
/**
 * Creates one or more filesystem
 * (FileShare, FileMirroring). This method is responsible for creating
 * a Workflow and invoking the FileOrchestrationInterface.addStepsForCreateFileSystems
 *
 * @param fileDescriptors
 * @param taskId
 * @throws ControllerException
 */
@Override
public void createFileSystems(List<FileDescriptor> fileDescriptors, String taskId) throws ControllerException {
    // Generate the Workflow.
    Workflow workflow = null;
    List<URI> fsUris = FileDescriptor.getFileSystemURIs(fileDescriptors);
    FileCreateWorkflowCompleter completer = new FileCreateWorkflowCompleter(fsUris, taskId, fileDescriptors);
    try {
        // Generate the Workflow.
        workflow = _workflowService.getNewWorkflow(this, CREATE_FILESYSTEMS_WF_NAME, false, taskId);
        // the wait for key returned by previous call
        String waitFor = null;
        s_logger.info("Generating steps for create FileSystem");
        // First, call the FileDeviceController to add its methods.
        waitFor = _fileDeviceController.addStepsForCreateFileSystems(workflow, waitFor, fileDescriptors, taskId);
        // second, check for policies that has to applied on this file system..
        waitFor = addStepsForApplyingPolicies(workflow, waitFor, fileDescriptors);
        // Finish up and execute the plan.
        // The Workflow will handle the TaskCompleter
        String successMessage = "Create filesystems successful for: " + fsUris.toString();
        Object[] callbackArgs = new Object[] { fsUris };
        workflow.executePlan(completer, successMessage, new WorkflowCallback(), callbackArgs, null, null);
    } catch (Exception ex) {
        s_logger.error("Could not create filesystems: " + fsUris, ex);
        releaseWorkflowLocks(workflow);
        String opName = ResourceOperationTypeEnum.CREATE_FILE_SYSTEM.getName();
        ServiceError serviceError = DeviceControllerException.errors.createFileSharesFailed(fsUris.toString(), opName, ex);
        completer.error(s_dbClient, _locker, serviceError);
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) FileCreateWorkflowCompleter(com.emc.storageos.volumecontroller.impl.file.FileCreateWorkflowCompleter) 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 FileCreateWorkflowCompleter (com.emc.storageos.volumecontroller.impl.file.FileCreateWorkflowCompleter)1 Workflow (com.emc.storageos.workflow.Workflow)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 URI (java.net.URI)1