Search in sources :

Example 11 with BlockVirtualPoolRestRep

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

the class BlockProvider method getVPlexVolumesInTargetVArray.

/**
 * Gets all {@link VolumeRestRep}s that are either in the target VArray or use the target VArray for protection
 *
 * @param client the ViPR client instance.
 * @param targetVArrayId the target VArray ID.
 * @param volumes the volumes we are concerned with. (These should be VPlex volumes)
 * @return List of {@link VolumeRestRep}s that are VPlex volumes that are in the target VArray
 */
public static List<BlockObjectRestRep> getVPlexVolumesInTargetVArray(ViPRCoreClient client, URI targetVArrayId, List<VolumeRestRep> volumes) {
    // collect vpools used by these volumes
    Map<URI, BlockVirtualPoolRestRep> vpools = getVpoolsForVolumes(client, volumes);
    // sift through the volumes to find ones with the correct VArray
    List<BlockObjectRestRep> acceptedVolumes = Lists.newArrayList();
    for (VolumeRestRep volume : volumes) {
        if (volume.getVirtualArray().getId().equals(targetVArrayId)) {
            addVolume(acceptedVolumes, volume);
        } else {
            // if this volume's HA type is 'distributed' and its distributed VArray matches the target VArray we can accept the volume
            URI vpoolId = volume.getVirtualPool().getId();
            BlockVirtualPoolRestRep volumeVpool = vpools.get(vpoolId);
            if (volumeVpool != null && isVpoolProtectedByVarray(volumeVpool, targetVArrayId)) {
                addVolume(acceptedVolumes, volume);
            }
        }
    }
    return acceptedVolumes;
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 12 with BlockVirtualPoolRestRep

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

the class VirtualArrayProvider method getBlockVirtualArrays.

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

Example 13 with BlockVirtualPoolRestRep

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

the class VirtualDataCenterProvider method getExportedIngestionMethod.

@Asset("exportedIngestionMethod")
@AssetDependencies({ "unmanagedBlockVirtualPool" })
public List<AssetOption> getExportedIngestionMethod(AssetOptionsContext ctx, URI virtualPoolId) {
    ViPRCoreClient client = api(ctx);
    BlockVirtualPoolRestRep virtualPoolRestRep = client.blockVpools().get(virtualPoolId);
    List<AssetOption> options = Lists.newArrayList();
    options.add(newAssetOption(IngestionMethodEnum.FULL.toString(), "unmanagedVolume.ingestMethod.full"));
    if (virtualPoolRestRep.getHighAvailability() != null) {
        options.add(newAssetOption(IngestionMethodEnum.VIRTUAL_VOLUMES_ONLY.toString(), "unmanagedVolume.ingestMethod.virtualVolumesOnly"));
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 14 with BlockVirtualPoolRestRep

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

the class VirtualDataCenterProvider method getUnmanagedVolumeVirtualPools.

@Asset("unmanagedBlockVirtualPool")
@AssetDependencies({ "unmanagedBlockStorageSystem" })
public List<AssetOption> getUnmanagedVolumeVirtualPools(AssetOptionsContext ctx, URI storageSystem) {
    Map<URI, Integer> vpools = getBlockVirtualPools(listUnmanagedVolumes(ctx, storageSystem));
    Map<URI, BlockVirtualPoolRestRep> virtualPoolMap = BlockProvider.getBlockVirtualPools(api(ctx), vpools.keySet());
    List<AssetOption> options = Lists.newArrayList();
    for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
        BlockVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
        if (vpool != null) {
            options.add(newAssetOption(vpool.getId().toString(), "block.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) URI(java.net.URI) Map(java.util.Map) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 15 with BlockVirtualPoolRestRep

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

the class ViPRClientApp method createBlockVolumeForHost.

public void createBlockVolumeForHost() {
    List<HostRestRep> hosts = client.hosts().getByUserTenant(HostTypeFilter.ESX.not());
    // User choice
    HostRestRep selectedHost = chooseHost(hosts);
    List<VirtualArrayRestRep> virtualArrays = client.varrays().findByConnectedHost(selectedHost);
    // User choice
    VirtualArrayRestRep selectedVirtualArray = chooseVirtualArray(virtualArrays);
    List<BlockVirtualPoolRestRep> virtualPools = client.blockVpools().getByVirtualArray(selectedVirtualArray.getId());
    // User choice
    BlockVirtualPoolRestRep selectedVirtualPool = chooseVirtualPool(virtualPools);
    List<ProjectRestRep> projects = client.projects().getByUserTenant();
    // User choice
    ProjectRestRep selectedProject = chooseProject(projects);
    URI volumeId = createVolume(selectedVirtualArray, selectedVirtualPool, selectedProject);
    List<ExportGroupRestRep> exports = new ArrayList<>();
    if (exports.isEmpty()) {
        createExport(volumeId, selectedHost, selectedVirtualArray, selectedProject);
    } else {
        addVolumeToExport(volumeId, exports.get(0));
    }
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) ArrayList(java.util.ArrayList) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) URI(java.net.URI)

Aggregations

BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)26 URI (java.net.URI)10 Asset (com.emc.sa.asset.annotation.Asset)6 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)5 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)4 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 BlockVirtualPoolForm (models.virtualpool.BlockVirtualPoolForm)4 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)3 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)3 Map (java.util.Map)3 StringSet (com.emc.storageos.db.client.model.StringSet)2 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)2 BlockVirtualPoolParam (com.emc.storageos.model.vpool.BlockVirtualPoolParam)2