Search in sources :

Example 21 with FileDescriptor

use of com.emc.storageos.fileorchestrationcontroller.FileDescriptor in project coprhd-controller by CoprHD.

the class AbstractFileServiceApiImpl method expandFileShare.

/**
 * Expand fileshare
 */
@Override
public void expandFileShare(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.expandMirrorFileSupportedOnlyOnSource(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 expand filesystem call in queue
    controller.expandFileSystem(fileDescriptors, taskId);
}
Also used : FileOrchestrationController(com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController) ArrayList(java.util.ArrayList) FileShare(com.emc.storageos.db.client.model.FileShare) FileDescriptor(com.emc.storageos.fileorchestrationcontroller.FileDescriptor)

Aggregations

FileDescriptor (com.emc.storageos.fileorchestrationcontroller.FileDescriptor)21 FileShare (com.emc.storageos.db.client.model.FileShare)20 ArrayList (java.util.ArrayList)13 FileOrchestrationController (com.emc.storageos.fileorchestrationcontroller.FileOrchestrationController)8 URI (java.net.URI)7 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)5 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)4 Workflow (com.emc.storageos.workflow.Workflow)3 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 SMBShareMap (com.emc.storageos.db.client.model.SMBShareMap)2 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)2 FileSystemParam (com.emc.storageos.model.file.FileSystemParam)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 TaskMapper.toTask (com.emc.storageos.api.mapper.TaskMapper.toTask)1 MapFileShare (com.emc.storageos.api.mapper.functions.MapFileShare)1