Search in sources :

Example 36 with FileShareRestRep

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

the class FileProvider method getFailbackFileTarget.

@Asset("failbackFileTarget")
@AssetDependencies("protectedRemoteFileSystem")
public List<AssetOption> getFailbackFileTarget(AssetOptionsContext ctx, URI protectedFileSystem) {
    if (protectedFileSystem != null) {
        ViPRCoreClient client = api(ctx);
        List<AssetOption> options = Lists.newArrayList();
        debug("getting failbackFileTargets (protectedFileSystem=%s)", protectedFileSystem);
        FileShareRestRep file = client.fileSystems().get(protectedFileSystem);
        FileProtectionRestRep protection = file.getProtection();
        if (protection != null) {
            List<VirtualArrayRelatedResourceRep> targets = protection.getTargetFileSystems();
            for (VirtualArrayRelatedResourceRep target : targets) {
                FileShareRestRep fileshare = client.fileSystems().get(target.getId());
                options.add(new AssetOption(fileshare.getId(), fileshare.getName()));
            }
        }
        AssetOptionsUtils.sortOptionsByLabel(options);
        return options;
    }
    return Lists.newArrayList();
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 37 with FileShareRestRep

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

the class FileProvider method getSubDir.

private String getSubDir(AssetOptionsContext ctx, ExportRule export) {
    FileShareRestRep fs = api(ctx).fileSystems().get(export.getFsID());
    String subDir = export.getExportPath().replace(fs.getMountPath(), "");
    if (subDir.startsWith("/")) {
        subDir = subDir.replaceFirst("/", "");
    }
    return subDir;
}
Also used : FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 38 with FileShareRestRep

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

the class FileProvider method getFileFilesystemSourceArrayForAssociation.

@Asset("fileFilesystemSourceArray")
@AssetDependencies("fileFilesystemAssociation")
public List<AssetOption> getFileFilesystemSourceArrayForAssociation(AssetOptionsContext ctx, URI fsId) {
    ViPRCoreClient client = api(ctx);
    VirtualArrayRestRep vArray = null;
    List<AssetOption> options = Lists.newArrayList();
    FileShareRestRep fsObj = client.fileSystems().get(fsId);
    if (fsObj != null) {
        vArray = client.varrays().get(fsObj.getVirtualArray().getId());
        options.add(createBaseResourceOption(vArray));
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 39 with FileShareRestRep

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

the class FileProvider method createFilesystemOptions.

/**
 * Create filesystem options from the list of filesystems, filtering using the given predicate
 *
 * @return The list of AssetOptions
 */
protected List<AssetOption> createFilesystemOptions(Collection<FileShareRestRep> filesystems, Predicate predicate) {
    CollectionUtils.filter(filesystems, predicate);
    List<AssetOption> options = Lists.newArrayList();
    for (FileShareRestRep fs : filesystems) {
        options.add(new AssetOption(fs.getId(), getLabel(fs)));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep)

Example 40 with FileShareRestRep

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

the class FileProvider method getExportedFilesystems.

// For mount operation
@Asset("fileExportedFilesystem")
@AssetDependencies("project")
public List<AssetOption> getExportedFilesystems(AssetOptionsContext ctx, URI project) {
    List<FileShareRestRep> filesystems = api(ctx).fileSystems().findByProject(project);
    List<FileShareRestRep> exportedFS = new ArrayList<FileShareRestRep>();
    for (FileShareRestRep fs : filesystems) {
        if (!api(ctx).fileSystems().getExports(fs.getId()).isEmpty()) {
            exportedFS.add(fs);
        }
    }
    return createFilesystemOptions(exportedFS, null);
}
Also used : ArrayList(java.util.ArrayList) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) 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