Search in sources :

Example 91 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient 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)

Example 92 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileProvider method getUnprotectedFileSystems.

@Asset("unprotectedFilesystem")
@AssetDependencies({ "project" })
public List<AssetOption> getUnprotectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting unprotected file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && fileShare.getProtection().getPersonality() == null) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 93 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileProvider method getSnapshotFilesystems.

@Asset("fileSnapshotFilesystem")
@AssetDependencies({ "project" })
public List<AssetOption> getSnapshotFilesystems(AssetOptionsContext ctx, URI project) {
    ViPRCoreClient client = api(ctx);
    Collection<FileShareRestRep> filesystems = client.fileSystems().findByProject(project);
    Map<URI, FileVirtualPoolRestRep> pools = getFileVirtualPools(client, filesystems);
    return createFilesystemOptions(filesystems, new SnapableFilesystemsPredicate(pools));
}
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)

Example 94 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileProvider method getProtectedFileSystems.

@Asset("protectedRemoteFileSystem")
@AssetDependencies({ "project" })
public List<AssetOption> getProtectedFileSystems(AssetOptionsContext ctx, URI project) {
    debug("getting protected remote file system (project=%s)", project);
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<FileShareRestRep> fileSystems = client.fileSystems().findByProject(project);
    for (FileShareRestRep fileShare : fileSystems) {
        if (fileShare.getProtection() != null && StringUtils.equals(FileShare.PersonalityTypes.SOURCE.toString(), fileShare.getProtection().getPersonality())) {
            options.add(new AssetOption(fileShare.getId(), fileShare.getName()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 95 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class FileProvider method getFileSourceVirtualPool.

@Asset("fileSourceVirtualPool")
@AssetDependencies({ "unprotectedFilesystem" })
public List<AssetOption> getFileSourceVirtualPool(AssetOptionsContext ctx, URI fileSystems) {
    List<AssetOption> options = Lists.newArrayList();
    ViPRCoreClient client = api(ctx);
    URI sourceVpoolId = client.fileSystems().get(fileSystems).getVirtualPool().getId();
    FileVirtualPoolRestRep sourceVpool = client.fileVpools().get(sourceVpoolId);
    options.add(new AssetOption(sourceVpool.getId(), sourceVpool.getName()));
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8