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);
}
}
Aggregations