Search in sources :

Example 46 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class CreateNfsExportAndDatastoreService method execute.

@Override
public void execute() throws Exception {
    URI fileSystemId = createNfsExportHelper.createNfsExport();
    List<Datastore> datastores = Lists.newArrayList();
    FileShareRestRep fileSystem = FileStorageUtils.getFileSystem(fileSystemId);
    FileSystemExportParam export = createNfsExportHelper.getNfsExport(fileSystemId);
    connectAndInitializeHost();
    if (cluster != null) {
        datastores.addAll(vmware.createNfsDatastore(cluster, fileSystem, export, datacenterId, datastoreName));
    } else {
        datastores.add(vmware.createNfsDatastore(host, fileSystem, export, datacenterId, datastoreName));
    }
    if (hostId != null) {
        ExecutionUtils.addAffectedResource(hostId.toString());
    }
    for (Datastore datastore : datastores) {
        vmware.setStorageIOControl(datastore, storageIOControl, true);
    }
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) Datastore(com.vmware.vim25.mo.Datastore) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI)

Example 47 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class AffectedResources method getFileMirror.

private static List<FileShareRestRep> getFileMirror(ViPRCoreClient client, URI id) {
    try {
        if (id != null) {
            List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
            FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
            for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
                fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
            }
            return fileMirrors;
        }
    } catch (Exception e) {
        Logger.debug(e, "Failed to retrieve file system: %s", id);
    }
    return null;
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 48 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileStorageUtils method getFileProtectionPolicies.

public static List<URI> getFileProtectionPolicies(URI fileSytem) {
    List<URI> policyURI = new ArrayList<>();
    FileShareRestRep resp = getFileSystem(fileSytem);
    if (resp.getFilePolicies() != null && !resp.getFilePolicies().isEmpty()) {
        Set<String> policySet = resp.getFilePolicies();
        for (String policy : policySet) {
            policyURI.add(URIUtil.uri(policy));
        }
    }
    return policyURI;
}
Also used : ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI)

Example 49 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileStorageUtils method createFileSystem.

public static URI createFileSystem(URI project, URI virtualArray, URI virtualPool, String label, double sizeInGb, int advisoryLimit, int softLimit, int gracePeriod) {
    Task<FileShareRestRep> task = execute(new CreateFileSystem(label, sizeInGb, advisoryLimit, softLimit, gracePeriod, virtualPool, virtualArray, project));
    addAffectedResource(task);
    URI fileSystemId = task.getResourceId();
    addRollback(new DeactivateFileSystem(fileSystemId, FileControllerConstants.DeleteTypeEnum.FULL));
    logInfo("file.storage.filesystem.task", task.getResourceId(), task.getOpId());
    return fileSystemId;
}
Also used : DeactivateFileSystem(com.emc.sa.service.vipr.file.tasks.DeactivateFileSystem) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) CreateFileSystem(com.emc.sa.service.vipr.file.tasks.CreateFileSystem) URI(java.net.URI)

Example 50 with FileShareRestRep

use of com.emc.storageos.model.file.FileShareRestRep in project coprhd-controller by CoprHD.

the class FileStorageUtils method getMirrorFileSystems.

public static List<URI> getMirrorFileSystems(URI fileSystem) {
    FileShareRestRep fileShare = getFileSystem(fileSystem);
    List<URI> targetFS = new ArrayList<>();
    if (fileShare.getProtection() != null && fileShare.getProtection().getTargetFileSystems() != null) {
        List<VirtualArrayRelatedResourceRep> responses = fileShare.getProtection().getTargetFileSystems();
        for (VirtualArrayRelatedResourceRep resp : responses) {
            targetFS.add(resp.getId());
        }
    }
    return targetFS;
}
Also used : ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Aggregations

FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)66 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)27 URI (java.net.URI)15 Asset (com.emc.sa.asset.annotation.Asset)13 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)13 AssetOption (com.emc.vipr.model.catalog.AssetOption)10 ArrayList (java.util.ArrayList)7 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)6 FileProtectionRestRep (com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep)5 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)5 Task (com.emc.vipr.client.Task)4 FlashException (controllers.util.FlashException)4 CreateFileSystem (com.emc.sa.service.vipr.file.tasks.CreateFileSystem)3 DeactivateFileSystem (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystem)3 DeactivateFileSystemExportRule (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemExportRule)3 FileSystemDeleteParam (com.emc.storageos.model.file.FileSystemDeleteParam)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)3 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)3 MachineTagsCollection (com.emc.sa.machinetags.MachineTagsCollection)2 DeactivateFileSystemShare (com.emc.sa.service.vipr.file.tasks.DeactivateFileSystemShare)2