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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations