Search in sources :

Example 11 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep 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 12 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep 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 13 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep 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)

Example 14 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class VirtualArrayProvider method getFileVirtualArrays.

@Asset("fileVirtualArray")
public List<AssetOption> getFileVirtualArrays(AssetOptionsContext context) {
    ViPRCoreClient client = api(context);
    // Get the set of virtual arrays that are associated with file vpools
    Set<URI> varrayIds = new HashSet<>();
    for (FileVirtualPoolRestRep vpool : client.fileVpools().getByTenant(context.getTenant())) {
        varrayIds.addAll(ResourceUtils.refIds(vpool.getVirtualArrays()));
    }
    filterByContextTenant(varrayIds, client.varrays().getByTenant(context.getTenant()));
    return createBaseResourceOptions(client.varrays().getByIds(varrayIds));
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) URI(java.net.URI) HashSet(java.util.HashSet) Asset(com.emc.sa.asset.annotation.Asset)

Example 15 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenterProvider method getUnmanagedFileSystemVirtualPools.

@Asset("unmanagedFileVirtualPool")
@AssetDependencies({ "fileStorageSystem", "virtualArray" })
public List<AssetOption> getUnmanagedFileSystemVirtualPools(AssetOptionsContext ctx, URI storageSystem, URI virtualArray) {
    Map<URI, Integer> vpools = getFileVirtualPools(listUnmanagedFilesystems(ctx, storageSystem));
    Map<URI, FileVirtualPoolRestRep> virtualPoolMap = FileProvider.getFileVirtualPools(api(ctx), vpools.keySet());
    List<AssetOption> options = Lists.newArrayList();
    for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
        FileVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
        if (isVirtualPoolInVirtualArray(vpool, virtualArray)) {
            options.add(newAssetOption(vpool.getId().toString(), "file.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) URI(java.net.URI) Map(java.util.Map) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)21 Asset (com.emc.sa.asset.annotation.Asset)8 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)7 URI (java.net.URI)7 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 AssetOption (com.emc.vipr.model.catalog.AssetOption)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)3 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)3 FileVirtualPoolProtectionParam (com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)3 Map (java.util.Map)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)2 FileVirtualPoolForm (models.virtualpool.FileVirtualPoolForm)2 VirtualPoolMapper.toFileVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool)1 MapFileVirtualPool (com.emc.storageos.api.mapper.functions.MapFileVirtualPool)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)1 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)1 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)1