Search in sources :

Example 16 with ExportGroupRestRep

use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.

the class BlockStorageUtils method createClusterExport.

public static URI createClusterExport(URI projectId, URI virtualArrayId, List<URI> volumeIds, Integer hlu, Cluster cluster, Map<URI, Integer> volumeHlus, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
    String exportName = cluster.getLabel();
    Task<ExportGroupRestRep> task = execute(new CreateExport(exportName, virtualArrayId, projectId, volumeIds, hlu, cluster.getLabel(), null, cluster.getId(), volumeHlus, minPaths, maxPaths, pathsPerInitiator, portGroup));
    URI exportId = task.getResourceId();
    addRollback(new DeactivateBlockExport(exportId));
    addAffectedResource(exportId);
    return exportId;
}
Also used : DeactivateBlockExport(com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) CreateExport(com.emc.sa.service.vipr.block.tasks.CreateExport) URI(java.net.URI)

Example 17 with ExportGroupRestRep

use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.

the class BlockStorageUtils method createHostExport.

public static URI createHostExport(URI projectId, URI virtualArrayId, List<URI> volumeIds, Integer hlu, Host host, Map<URI, Integer> volumeHlus, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
    String exportName = host.getHostName();
    Task<ExportGroupRestRep> task = execute(new CreateExport(exportName, virtualArrayId, projectId, volumeIds, hlu, host.getHostName(), host.getId(), null, volumeHlus, minPaths, maxPaths, pathsPerInitiator, portGroup));
    URI exportId = task.getResourceId();
    addRollback(new DeactivateBlockExport(exportId));
    addAffectedResource(exportId);
    return exportId;
}
Also used : DeactivateBlockExport(com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) CreateExport(com.emc.sa.service.vipr.block.tasks.CreateExport) URI(java.net.URI)

Example 18 with ExportGroupRestRep

use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.

the class BlockStorageUtils method findBlockVolumeHLUs.

public static Map<URI, Integer> findBlockVolumeHLUs(Collection<URI> volumeIds) {
    List<ITLRestRep> bulkResponse = execute(new FindBlockVolumeHlus(volumeIds));
    Map<URI, Integer> volumeHLUs = Maps.newHashMap();
    for (ITLRestRep export : bulkResponse) {
        ExportGroupRestRep exportGroup = getExport(export.getExport().getId());
        if (!exportGroup.getInternal()) {
            volumeHLUs.put(export.getBlockObject().getId(), export.getHlu());
        }
    }
    return volumeHLUs;
}
Also used : FindBlockVolumeHlus(com.emc.sa.service.vipr.block.tasks.FindBlockVolumeHlus) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) URI(java.net.URI)

Example 19 with ExportGroupRestRep

use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.

the class BlockProvider method getExportedBlockContinuousCopyByVolume.

@Asset("exportedBlockContinuousCopy")
@AssetDependencies({ "project", "volumeWithContinuousCopies" })
public List<AssetOption> getExportedBlockContinuousCopyByVolume(AssetOptionsContext ctx, URI project, URI volume) {
    debug("getting exported blockContinuousCopy (project=%s) (parent=%s)", project, volume);
    final ViPRCoreClient client = api(ctx);
    Set<URI> exportedMirrors = new HashSet<URI>();
    for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
        for (ExportBlockParam resource : export.getVolumes()) {
            if (ResourceType.isType(ResourceType.BLOCK_CONTINUOUS_COPY, resource.getId())) {
                exportedMirrors.add(resource.getId());
            }
        }
    }
    ExportedBlockResourceFilter<BlockMirrorRestRep> exportedMirrorFilter = new ExportedBlockResourceFilter<BlockMirrorRestRep>(exportedMirrors);
    List<BlockMirrorRestRep> mirrors = client.blockVolumes().getContinuousCopies(volume, exportedMirrorFilter);
    return createVolumeOptions(client, mirrors);
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) URI(java.net.URI) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 20 with ExportGroupRestRep

use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.

the class BlockProvider method getExportedVolumes.

/**
 * Gets the set of volume IDs for volumes in the given project that are exported to the given host/cluster
 *
 * @param client An instance of the ViPRCoreClient
 * @param projectId The ViPR ID of the project
 * @param hostOrClusterId The ViPR ID of the host/cluster
 *
 * @return The set of Volume IDs
 */
protected static Set<URI> getExportedVolumes(ViPRCoreClient client, URI projectId, URI hostOrClusterId, URI virtualArrayId) {
    // determine host and cluster id
    URI hostId = BlockStorageUtils.isHost(hostOrClusterId) ? hostOrClusterId : null;
    URI clusterId = BlockStorageUtils.isCluster(hostOrClusterId) ? hostOrClusterId : null;
    // get a list of all the exports in this project that expose resources to this host/cluster
    ResourceFilter<ExportGroupRestRep> filter;
    if (virtualArrayId == null) {
        filter = new ExportHostOrClusterFilter(hostId, clusterId);
    } else {
        filter = new ExportHostOrClusterFilter(hostId, clusterId).and(new ExportVirtualArrayFilter(virtualArrayId));
    }
    List<ExportGroupRestRep> exports = client.blockExports().findByProject(projectId, filter);
    return getBlockVolumeIdsForExports(exports);
}
Also used : ExportVirtualArrayFilter(com.emc.vipr.client.core.filters.ExportVirtualArrayFilter) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportHostOrClusterFilter(com.emc.vipr.client.core.filters.ExportHostOrClusterFilter) URI(java.net.URI)

Aggregations

ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)59 URI (java.net.URI)36 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)24 Asset (com.emc.sa.asset.annotation.Asset)10 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)10 FlashException (controllers.util.FlashException)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 AssetOption (com.emc.vipr.model.catalog.AssetOption)8 ArrayList (java.util.ArrayList)8 ExportBlockParam (com.emc.storageos.model.block.export.ExportBlockParam)7 DeactivateBlockExport (com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)5 ITLRestRep (com.emc.storageos.model.block.export.ITLRestRep)5 HostRestRep (com.emc.storageos.model.host.HostRestRep)5 HashSet (java.util.HashSet)5 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)4 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)4