Search in sources :

Example 1 with ExportHostOrClusterFilter

use of com.emc.vipr.client.core.filters.ExportHostOrClusterFilter 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);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) 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)

Example 2 with ExportHostOrClusterFilter

use of com.emc.vipr.client.core.filters.ExportHostOrClusterFilter 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)2 ExportHostOrClusterFilter (com.emc.vipr.client.core.filters.ExportHostOrClusterFilter)2 ExportVirtualArrayFilter (com.emc.vipr.client.core.filters.ExportVirtualArrayFilter)2 URI (java.net.URI)2 HostRestRep (com.emc.storageos.model.host.HostRestRep)1