use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor 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.FileDescriptor 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.FileDescriptor in project coprhd-controller by CoprHD.
the class FileMirrorServiceApiImpl method prepareFileDescriptors.
/**
* Prepare the file descriptors
*
* @param filesystems
* @param cosCapabilities
* @param suggestedId
* @return
*/
private List<FileDescriptor> prepareFileDescriptors(List<FileShare> filesystems, VirtualPoolCapabilityValuesWrapper cosCapabilities, String suggestedId) {
// Build up a list of FileDescriptors based on the fileshares
final List<FileDescriptor> fileDescriptors = new ArrayList<FileDescriptor>();
for (FileShare filesystem : filesystems) {
FileDescriptor.Type fileType = FileDescriptor.Type.FILE_MIRROR_SOURCE;
// Source desc type to create mirrors for existing file system!!
if (cosCapabilities.createMirrorExistingFileSystem()) {
fileType = FileDescriptor.Type.FILE_EXISTING_MIRROR_SOURCE;
}
if (filesystem.getPersonality() != null && filesystem.getPersonality().equals(FileShare.PersonalityTypes.TARGET.toString())) {
fileType = FileDescriptor.Type.FILE_MIRROR_TARGET;
}
VirtualPoolCapabilityValuesWrapper vpoolCapabilities = new VirtualPoolCapabilityValuesWrapper(cosCapabilities);
FileDescriptor desc = new FileDescriptor(fileType, filesystem.getStorageDevice(), filesystem.getId(), filesystem.getPool(), filesystem.getCapacity(), vpoolCapabilities, null, suggestedId);
fileDescriptors.add(desc);
}
return fileDescriptors;
}
use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.
the class DefaultFileServiceApiImpl method prepareFileDescriptors.
/**
* prepare the file descriptors
*
* @param filesystems
* @param cosCapabilities
* @param suggestedId
* @return
*/
private List<FileDescriptor> prepareFileDescriptors(List<FileShare> filesystems, VirtualPoolCapabilityValuesWrapper cosCapabilities, String suggestedId) {
// Build up a list of FileDescriptors based on the fileshares
final List<FileDescriptor> fileDescriptors = new ArrayList<FileDescriptor>();
for (FileShare filesystem : filesystems) {
FileDescriptor desc = new FileDescriptor(FileDescriptor.Type.FILE_DATA, filesystem.getStorageDevice(), filesystem.getId(), filesystem.getPool(), filesystem.getCapacity(), cosCapabilities, null, suggestedId);
fileDescriptors.add(desc);
}
return fileDescriptors;
}
use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.
the class AbstractFileServiceApiImpl method reduceFileShareQuota.
/**
* Reduce fileshare provision capacity
* @param fileshare file share object
* @param newSize - new fileshare size
* @param taskId - task id
* return
*/
@Override
public void reduceFileShareQuota(FileShare fileshare, Long newSize, String taskId) throws InternalException {
FileOrchestrationController controller = getController(FileOrchestrationController.class, FileOrchestrationController.FILE_ORCHESTRATION_DEVICE);
final List<FileDescriptor> fileDescriptors = new ArrayList<FileDescriptor>();
if (fileshare.getParentFileShare() != null && fileshare.getPersonality().equals(FileShare.PersonalityTypes.TARGET.name())) {
throw APIException.badRequests.reduceMirrorFileSupportedOnlyOnSource(fileshare.getId());
} else {
List<String> targetfileUris = new ArrayList<String>();
// if filesystem is target then throw exception
if (fileshare.getMirrorfsTargets() != null && !fileshare.getMirrorfsTargets().isEmpty()) {
targetfileUris.addAll(fileshare.getMirrorfsTargets());
}
FileDescriptor descriptor = new FileDescriptor(FileDescriptor.Type.FILE_DATA, fileshare.getStorageDevice(), fileshare.getId(), fileshare.getPool(), "", false, newSize);
fileDescriptors.add(descriptor);
// Prepare the descriptor for targets
for (String target : targetfileUris) {
FileShare targetFileShare = _dbClient.queryObject(FileShare.class, URI.create(target));
descriptor = new FileDescriptor(FileDescriptor.Type.FILE_DATA, targetFileShare.getStorageDevice(), targetFileShare.getId(), targetFileShare.getPool(), "", false, newSize);
fileDescriptors.add(descriptor);
}
}
// place the reduce filesystem call in queue
controller.reduceFileSystem(fileDescriptors, taskId);
}
Aggregations