use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileMirrorServiceApiImpl method createTargetsForExistingSource.
@Override
public TaskResourceRep createTargetsForExistingSource(FileShare fs, Project project, VirtualPool vpool, VirtualArray varray, TaskList taskList, String task, List<Recommendation> recommendations, VirtualPoolCapabilityValuesWrapper vpoolCapabilities) throws InternalException {
List<FileShare> fileList = null;
List<FileShare> fileShares = new ArrayList<FileShare>();
FileSystemParam fsParams = new FileSystemParam();
fsParams.setFsId(fs.getId().toString());
fsParams.setLabel(fs.getLabel());
fsParams.setVarray(fs.getVirtualArray());
fsParams.setVpool(fs.getVirtualPool());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, project.getTenantOrg().getURI());
// Prepare the FileShares
fileList = prepareFileSystems(fsParams, task, taskList, project, tenant, null, varray, vpool, recommendations, vpoolCapabilities, false);
fileShares.addAll(fileList);
// prepare the file descriptors
final List<FileDescriptor> fileDescriptors = prepareFileDescriptors(fileShares, vpoolCapabilities, null);
final FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
try {
// Execute the create mirror copies of fileshare!!!
controller.createTargetsForExistingSource(fs.getId().toString(), fileDescriptors, task);
} catch (InternalException e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
} catch (Exception e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
}
return taskList.getTaskList().get(0);
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileMirrorServiceApiImpl method assignFilePolicyToFileSystem.
@Override
public void assignFilePolicyToFileSystem(FileShare fs, FilePolicy filePolicy, Project project, VirtualPool vpool, VirtualArray varray, TaskList taskList, String task, List<Recommendation> recommendations, VirtualPoolCapabilityValuesWrapper vpoolCapabilities) throws InternalException {
List<FileShare> fileList = null;
List<FileShare> fileShares = new ArrayList<>();
FileSystemParam fsParams = new FileSystemParam();
fsParams.setFsId(fs.getId().toString());
fsParams.setLabel(fs.getLabel());
fsParams.setVarray(fs.getVirtualArray());
fsParams.setVpool(fs.getVirtualPool());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, project.getTenantOrg().getURI());
// Prepare the FileShares
fileList = prepareFileSystems(fsParams, task, taskList, project, tenant, null, varray, vpool, recommendations, vpoolCapabilities, false);
fileShares.addAll(fileList);
// prepare the file descriptors
final List<FileDescriptor> fileDescriptors = prepareFileDescriptors(fileShares, vpoolCapabilities, null);
final FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
try {
// Execute the create mirror copies of file share!!!
controller.assignFilePolicyToFileSystem(filePolicy, fileDescriptors, task);
} catch (InternalException e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
} catch (Exception e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
}
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileService method assignFilePolicyToFS.
private TaskResourceRep assignFilePolicyToFS(FileShare fs, FilePolicy filePolicy, String task) {
StorageSystem device = _dbClient.queryObject(StorageSystem.class, fs.getStorageDevice());
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
Operation op = _dbClient.createTaskOpStatus(FileShare.class, fs.getId(), task, ResourceOperationTypeEnum.ASSIGN_FILE_POLICY_TO_FILE_SYSTEM);
op.setDescription("assign file policy to file system");
// As the action done by tenant admin
// Set current tenant as task's tenant!!!
Task taskObj = op.getTask(fs.getId());
FilePolicyServiceUtils.updateTaskTenant(_dbClient, filePolicy, "assign", taskObj, fs.getTenant().getURI());
try {
_log.info("No Errors found proceeding further {}, {}, {}", new Object[] { _dbClient, fs, filePolicy });
List<FileDescriptor> fileDescriptors = new ArrayList<>();
FileDescriptor desc = new FileDescriptor(Type.FILE_EXISTING_SOURCE, fs.getId());
fileDescriptors.add(desc);
controller.assignFilePolicyToFileSystem(filePolicy, fileDescriptors, task);
auditOp(OperationTypeEnum.ASSIGN_FILE_POLICY, true, AuditLogManager.AUDITOP_BEGIN, fs.getId().toString(), device.getId().toString(), filePolicy.getId());
} catch (BadRequestException e) {
_dbClient.error(FileShare.class, fs.getId(), task, e);
_log.error("Error Assigning Filesystem policy {}, {}", e.getMessage(), e);
throw e;
} catch (Exception e) {
_log.error("Error Assigning Filesystem policy {}, {}", e.getMessage(), e);
throw APIException.badRequests.unableToProcessRequest(e.getMessage());
}
return toTask(fs, task, op);
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class DefaultFileServiceApiImpl method createFileSystems.
@Override
public TaskList createFileSystems(FileSystemParam param, Project project, VirtualArray varray, VirtualPool vpool, TenantOrg tenantOrg, DataObject.Flag[] flags, List<Recommendation> recommendations, TaskList taskList, String task, VirtualPoolCapabilityValuesWrapper vpoolCapabilities) throws InternalException {
List<FileShare> fileList = null;
List<FileShare> fileShares = new ArrayList<FileShare>();
// Prepare the FileShares
fileList = getFileScheduler().prepareFileSystems(param, task, taskList, project, varray, vpool, recommendations, vpoolCapabilities, false);
fileShares.addAll(fileList);
// prepare the file descriptors
String suggestedNativeFsId = param.getFsId() == null ? "" : param.getFsId();
final List<FileDescriptor> fileDescriptors = prepareFileDescriptors(fileShares, vpoolCapabilities, suggestedNativeFsId);
final FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
try {
// Execute the fileshare creations requests
controller.createFileSystems(fileDescriptors, task);
} catch (InternalException e) {
_log.error("Controller error when creating filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
} catch (Exception e) {
_log.error("Controller error when creating filesystems", e);
failFileShareCreateRequest(task, taskList, fileShares, e.getMessage());
throw e;
}
return taskList;
}
use of com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController in project coprhd-controller by CoprHD.
the class FileMirrorServiceApiImpl method createFileSystems.
/**
* It take mirror recommendation and then creates source and mirror fileshare
*/
@Override
public TaskList createFileSystems(FileSystemParam param, Project project, VirtualArray varray, VirtualPool vpool, TenantOrg tenantOrg, DataObject.Flag[] flags, List<Recommendation> recommendations, TaskList taskList, String taskId, VirtualPoolCapabilityValuesWrapper vpoolCapabilities) throws InternalException {
List<FileShare> fileList = null;
List<FileShare> fileShares = new ArrayList<FileShare>();
// Prepare the FileShares
fileList = prepareFileSystems(param, taskId, taskList, project, tenantOrg, flags, varray, vpool, recommendations, vpoolCapabilities, false);
fileShares.addAll(fileList);
// prepare the file descriptors
String suggestedNativeFsId = param.getFsId() == null ? "" : param.getFsId();
final List<FileDescriptor> fileDescriptors = prepareFileDescriptors(fileShares, vpoolCapabilities, suggestedNativeFsId);
final FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
try {
// Execute the fileshare creations requests
controller.createFileSystems(fileDescriptors, taskId);
} catch (InternalException e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(taskId, taskList, fileShares, e.getMessage());
throw e;
} catch (Exception e) {
_log.error("Controller error when creating mirror filesystems", e);
failFileShareCreateRequest(taskId, taskList, fileShares, e.getMessage());
throw e;
}
return taskList;
}
Aggregations