Search in sources :

Example 6 with BlockVirtualPoolRestRep

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

the class BlockProvider method getBlockVolumes.

@Asset("unassignedVplexBlockVolume")
@AssetDependencies({ "project", "host", "virtualArray" })
public List<AssetOption> getBlockVolumes(AssetOptionsContext ctx, final URI projectId, URI hostOrClusterId, URI virtualArrayId) {
    // get a list of all 'source' volumes that :
    // - are in this project and not exported to the given host/cluster
    // - are a 'source' volume
    // - are vplex volumes
    ViPRCoreClient client = api(ctx);
    Set<URI> exportedBlockResources = BlockProvider.getExportedVolumes(client, projectId, hostOrClusterId, virtualArrayId);
    UnexportedBlockResourceFilter<VolumeRestRep> unexportedFilter = new UnexportedBlockResourceFilter<VolumeRestRep>(exportedBlockResources);
    SourceTargetVolumesFilter sourceTargetVolumesFilter = new SourceTargetVolumesFilter();
    VplexVolumeFilter vplexVolumeFilter = new VplexVolumeFilter();
    CachedResources<BlockVirtualPoolRestRep> blockVpools = new CachedResources<>(client.blockVpools());
    VplexVolumeVirtualPoolFilter virtualPoolFilter = new VplexVolumeVirtualPoolFilter(blockVpools);
    BlockVolumeBootVolumeFilter bootVolumeFilter = new BlockVolumeBootVolumeFilter();
    FilterChain<VolumeRestRep> filter = sourceTargetVolumesFilter.and(unexportedFilter).and(bootVolumeFilter.not()).and(vplexVolumeFilter.or(virtualPoolFilter));
    // perform the query and apply the filter
    List<VolumeRestRep> volumes = client.blockVolumes().findByProject(projectId, filter);
    // get a list of all volumes from our list that are in the target VArray, or use the target VArray for protection
    List<BlockObjectRestRep> acceptedVolumes = getVPlexVolumesInTargetVArray(client, virtualArrayId, volumes);
    return createVolumeOptions(client, acceptedVolumes);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) SourceTargetVolumesFilter(com.emc.vipr.client.core.filters.SourceTargetVolumesFilter) URI(java.net.URI) VplexVolumeFilter(com.emc.vipr.client.core.filters.VplexVolumeFilter) BlockVolumeBootVolumeFilter(com.emc.vipr.client.core.filters.BlockVolumeBootVolumeFilter) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) CachedResources(com.emc.vipr.client.core.util.CachedResources) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) VplexVolumeVirtualPoolFilter(com.emc.vipr.client.core.filters.VplexVolumeVirtualPoolFilter) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 7 with BlockVirtualPoolRestRep

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

the class VirtualDataCenterProvider method getUnmanagedVolumeVirtualPoolsForHost.

@Asset("unmanagedBlockVirtualPool")
@AssetDependencies({ "host", "virtualArray" })
public List<AssetOption> getUnmanagedVolumeVirtualPoolsForHost(AssetOptionsContext ctx, URI host, URI virtualArray) {
    Map<URI, Integer> vpools = getBlockVirtualPools(listUnmanagedVolumesByHost(ctx, host));
    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 (isVirtualPoolInVirtualArray(vpool, virtualArray)) {
            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 8 with BlockVirtualPoolRestRep

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

the class BlockStorageUtils method isVMAXUsePortGroupEnabled.

public static boolean isVMAXUsePortGroupEnabled(URI resourceId) {
    SimpleValueRep value = execute(new GetVMAXUsePortGroupEnabledConfig());
    if (value.getValue().equalsIgnoreCase("true")) {
        if (ResourceType.isType(ResourceType.VOLUME, resourceId)) {
            BlockObjectRestRep obj = getVolume(resourceId);
            if (obj instanceof VolumeRestRep) {
                VolumeRestRep volume = (VolumeRestRep) obj;
                boolean isVMAX = StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
                boolean isRPOrVPlex = isVplexOrRPVolume(volume);
                if (isVMAX && !isRPOrVPlex) {
                    return true;
                }
            }
            if (obj instanceof BlockSnapshotRestRep) {
                BlockSnapshotRestRep snapshot = (BlockSnapshotRestRep) obj;
                BlockObjectRestRep parent = getVolume(snapshot.getParent().getId());
                if (parent instanceof VolumeRestRep) {
                    VolumeRestRep volume = (VolumeRestRep) obj;
                    if (StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(volume.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                        return true;
                    }
                }
                if (parent instanceof BlockMirrorRestRep) {
                    BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
                    if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                        return true;
                    }
                }
            }
            if (obj instanceof BlockMirrorRestRep) {
                BlockMirrorRestRep mirror = (BlockMirrorRestRep) obj;
                if (StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(mirror.getSystemType(), DiscoveredDataObject.Type.vmax3.name())) {
                    return true;
                }
            }
        }
        if (ResourceType.isType(ResourceType.VIRTUAL_POOL, resourceId)) {
            BlockVirtualPoolRestRep virtualPool = execute(new GetBlockVirtualPool(resourceId));
            boolean isVMAX = StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax.name()) || StringUtils.equalsIgnoreCase(virtualPool.getSystemType(), DiscoveredDataObject.Type.vmax3.name());
            boolean isVPLEX = virtualPool.getHighAvailability() != null;
            if (isVMAX && !isVPLEX) {
                return true;
            }
        }
    }
    return false;
}
Also used : SimpleValueRep(com.emc.storageos.model.customconfig.SimpleValueRep) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) GetBlockVirtualPool(com.emc.sa.service.vipr.block.tasks.GetBlockVirtualPool) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) GetVMAXUsePortGroupEnabledConfig(com.emc.sa.service.vipr.block.tasks.GetVMAXUsePortGroupEnabledConfig) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 9 with BlockVirtualPoolRestRep

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

the class BlockProvider method getVolumeDetails.

/**
 * Gets the volume details for a collection of volumes.
 *
 * @param client the bourne client.
 * @param volumes the collection of volumes.
 * @return the volume details.
 */
protected static List<VolumeDetail> getVolumeDetails(ViPRCoreClient client, Collection<VolumeRestRep> volumes) {
    Set<URI> blockVirtualPoolIds = getBlockVirtualPoolIdsForVolumes(volumes);
    Map<URI, BlockVirtualPoolRestRep> virtualPoolMap = getBlockVirtualPools(client, blockVirtualPoolIds);
    List<VolumeDetail> details = Lists.newArrayList();
    for (VolumeRestRep volume : volumes) {
        BlockVirtualPoolRestRep virtualPool = virtualPoolMap.get(volume.getVirtualPool().getId());
        details.add(new VolumeDetail(volume, virtualPool));
    }
    return details;
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 10 with BlockVirtualPoolRestRep

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

the class BlockProvider method getBlockSnapshotType.

@Asset("blockSnapshotType")
@AssetDependencies({ "blockVolumeOrConsistencyType", "snapshotBlockVolume" })
public List<AssetOption> getBlockSnapshotType(AssetOptionsContext ctx, String storageType, URI blockVolumeOrCG) {
    // These are hard coded values for now. In the future, this may be available through an API
    List<AssetOption> options = Lists.newArrayList();
    if (isConsistencyGroupType(blockVolumeOrCG)) {
        options.add(CG_SNAPSHOT_TYPE_OPTION);
        // Only add cg session option if the CG selected supports it
        ViPRCoreClient client = api(ctx);
        BlockConsistencyGroupRestRep cg = client.blockConsistencyGroups().get(blockVolumeOrCG);
        if (isSnapshotSessionSupportedForCG(cg)) {
            options.add(CG_SNAPSHOT_SESSION_TYPE_OPTION);
        }
    } else {
        debug("getting blockSnapshotTypes (blockVolume=%s)", blockVolumeOrCG);
        ViPRCoreClient client = api(ctx);
        VolumeRestRep volume = client.blockVolumes().get(blockVolumeOrCG);
        BlockVirtualPoolRestRep virtualPool = client.blockVpools().get(volume.getVirtualPool());
        if (isLocalSnapshotSupported(virtualPool)) {
            options.add(LOCAL_ARRAY_SNAPSHOT_TYPE_OPTION);
        }
        if (isRPSourceVolume(volume)) {
            options.add(RECOVERPOINT_BOOKMARK_SNAPSHOT_TYPE_OPTION);
        }
        if (isSnapshotSessionSupportedForVolume(volume)) {
            options.add(SNAPSHOT_SESSION_TYPE_OPTION);
        }
    }
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

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