use of com.emc.vipr.client.core.filters.ExportVirtualArrayFilter 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);
}
use of com.emc.vipr.client.core.filters.ExportVirtualArrayFilter in project coprhd-controller by CoprHD.
the class BlockExports method findByHostOrCluster.
/**
* Finds the exports associated with a host (or that host's cluster) that are for the given project. If a virtual
* array ID is specified, only exports associated with that virtual array are returned.
*
* @param hostId
* the ID of the host.
* @param projectId
* the ID of the project.
* @param virtualArrayId
* the ID of the virtual array to restrict the exports to, or null for no restriction.
* @return the list of export groups associated with the host or any host in the same cluster.
* @deprecated This method was only used in one test class {@code ViPRClientApp} which doesn't use this method anymore.
*/
@Deprecated
public List<ExportGroupRestRep> findByHostOrCluster(URI hostId, URI projectId, URI virtualArrayId) {
HostRestRep host = parent.hosts().get(hostId);
URI clusterId = (host != null) ? id(host.getCluster()) : null;
ResourceFilter<ExportGroupRestRep> filter;
if (virtualArrayId == null) {
filter = new ExportHostOrClusterFilter(hostId, clusterId);
} else {
filter = new ExportHostOrClusterFilter(hostId, clusterId).and(new ExportVirtualArrayFilter(virtualArrayId));
}
return findByProject(projectId, filter);
}
Aggregations