Search in sources :

Example 21 with FileShareRestRep

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

the class FileSystems method fileSystemSnapshotPolicies.

@FlashException(referrer = { "fileSystem" })
public static void fileSystemSnapshotPolicies(String fileSystemId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<FilePolicyRestRep> filePolicies = Lists.newArrayList();
    FileShareRestRep fs = client.fileSystems().get(uri(fileSystemId));
    if (fs != null) {
        // Get file system snapshot policies!!
        if (fs.getFilePolicies() != null && !fs.getFilePolicies().isEmpty()) {
            for (String uriPolicy : fs.getFilePolicies()) {
                FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
                if (policyRestRep != null) {
                    filePolicies.add(policyRestRep);
                }
            }
        }
    }
    render(filePolicies);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) FlashException(controllers.util.FlashException)

Example 22 with FileShareRestRep

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

the class FileSystems method listNfsAcl.

public static void listNfsAcl(String fileSystemId, String fsMountPath, String subDir) {
    renderArgs.put("dataTable", new NfsACLDataTable());
    renderArgs.put("subDir", subDir);
    renderArgs.put("fileSystemId", uri(fileSystemId));
    renderArgs.put("fsMountPath", fsMountPath);
    renderArgs.put("fileSystemSubDirAndPath", fileSystemId + "~~~" + subDir + "~~~" + fsMountPath);
    renderArgs.put("permissionOptions", StringOption.options(new String[] { "read", "write", "execute", "fullControl" }));
    ViPRCoreClient client = BourneUtil.getViprClient();
    NfsACLForm nfsACL = new NfsACLForm();
    FileShareRestRep restRep = client.fileSystems().get(uri(fileSystemId));
    renderArgs.put("fileSystemName", restRep.getName());
    render(nfsACL);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NfsACLDataTable(models.datatable.NfsACLDataTable) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 23 with FileShareRestRep

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

the class FileSystems method fileSystemMirrors.

public static void fileSystemMirrors(String fileSystemId) {
    URI id = uri(fileSystemId);
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
    List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
    for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
        fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
    }
    String personality = targetFileSystems.getPersonality();
    // The code will be refactored once 1:n or cascaded FS replication is supported
    if (!fileMirrors.isEmpty()) {
        FileShareRestRep fsRestRep = fileMirrors.get(0);
        fsRestRep.getProtection().setMirrorStatus(targetFileSystems.getMirrorStatus());
    }
    // Verify the replication is at fs level or not
    boolean replicationAtFs = false;
    FileShareRestRep fs = client.fileSystems().get(id);
    if (fs != null) {
        FilePolicyRestRep replicationPolicy = getReplicationPolicy(client, fs);
        if (replicationPolicy != null) {
            if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(replicationPolicy.getAppliedAt())) {
                replicationAtFs = true;
            }
            renderArgs.put("replicationPolicy", replicationPolicy);
        }
        renderArgs.put("replicationAtFsLevel", replicationAtFs);
    }
    renderArgs.put("personality", personality);
    renderArgs.put("fileMirrors", fileMirrors);
    renderArgs.put("fileSystemId", fileSystemId);
    render();
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ArrayList(java.util.ArrayList) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep)

Example 24 with FileShareRestRep

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

the class FileProvider method getFileWithContinuousCopies.

@Asset("fileWithContinuousCopies")
@AssetDependencies("project")
public List<AssetOption> getFileWithContinuousCopies(AssetOptionsContext ctx, URI project) {
    final ViPRCoreClient client = api(ctx);
    List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project, new SourceTargetFileSystemsFilter() {

        @Override
        public boolean acceptId(URI id) {
            return !client.fileSystems().getFileContinuousCopies(id).isEmpty();
        }
    });
    return createFilesystemOptions(fileShares);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) SourceTargetFileSystemsFilter(com.emc.vipr.client.core.filters.SourceTargetFileSystemsFilter) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 25 with FileShareRestRep

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

the class FileProvider method getFilesystemsForAssociation.

@Asset("fileFilesystemAssociation")
@AssetDependencies("project")
public List<AssetOption> getFilesystemsForAssociation(AssetOptionsContext ctx, URI project) {
    ViPRCoreClient client = api(ctx);
    List<FileShareRestRep> fileSharesforAssociation = Lists.newArrayList();
    Map<URI, Boolean> uriToBool = Maps.newHashMap();
    List<FileShareRestRep> fileShares = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileShares) {
        URI vpoolId = fileShare.getVirtualPool().getId();
        if (!uriToBool.containsKey(vpoolId)) {
            FileVirtualPoolRestRep vpool = client.fileVpools().get(vpoolId);
            uriToBool.put(vpoolId, (vpool.getProtection() != null && vpool.getProtection().getAllowFilePolicyAtFSLevel() && (vpool.getProtection().getReplicationSupported() || vpool.getProtection().getScheduleSnapshots())));
        }
        if (uriToBool.get(vpoolId)) {
            fileSharesforAssociation.add(fileShare);
        }
    }
    return createFilesystemOptions(fileSharesforAssociation);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

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