Search in sources :

Example 1 with FilterChain

use of com.emc.vipr.client.core.filters.FilterChain in project coprhd-controller by CoprHD.

the class BlockProvider method getExportedVolumes.

@Asset("exportedBlockVolume")
@AssetDependencies("project")
public List<AssetOption> getExportedVolumes(AssetOptionsContext ctx, URI project) {
    debug("getting source block volumes (project=%s)", project);
    final ViPRCoreClient client = api(ctx);
    // Filter volumes that are not RP Metadata
    List<URI> volumeIds = getExportedVolumeIds(ctx, project);
    FilterChain<VolumeRestRep> filter = new FilterChain<VolumeRestRep>(RecoverPointPersonalityFilter.METADATA.not());
    filter.and(new BlockVolumeVMFSDatastoreFilter().not());
    filter.and(new BlockVolumeBootVolumeFilter().not());
    filter.and(new BlockVolumeMountPointFilter().not());
    List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds, filter);
    return createVolumeWithVarrayOptions(client, volumes);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FilterChain(com.emc.vipr.client.core.filters.FilterChain) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockVolumeBootVolumeFilter(com.emc.vipr.client.core.filters.BlockVolumeBootVolumeFilter) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 2 with FilterChain

use of com.emc.vipr.client.core.filters.FilterChain in project coprhd-controller by CoprHD.

the class HostClusters method availableHostJson.

public static void availableHostJson(String id) {
    final URI clusterId = uri(id);
    ClusterRestRep cluster = ClusterUtils.getCluster(clusterId);
    List<HostRestRep> hosts = null;
    DefaultResourceFilter<HostRestRep> defaultHostResourceFilter = new DefaultResourceFilter<HostRestRep>() {

        @Override
        public boolean accept(HostRestRep hostRestRep) {
            return hostRestRep.getCluster() == null || !hostRestRep.getCluster().getId().equals(clusterId);
        }
    };
    // If we have existing hosts in the cluster, limit to that host type
    List<HostRestRep> existingHosts = ClusterUtils.getHosts(uri(id));
    if (!existingHosts.isEmpty()) {
        FilterChain<HostRestRep> hostTypeFilter = new FilterChain<HostRestRep>(new HostTypeFilter(existingHosts.get(0).getType()));
        hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), hostTypeFilter.and(defaultHostResourceFilter));
    } else {
        hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), defaultHostResourceFilter);
    }
    renderJSON(DataTablesSupport.createJSON(hosts, params));
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) FilterChain(com.emc.vipr.client.core.filters.FilterChain) URI(java.net.URI) HostTypeFilter(com.emc.vipr.client.core.filters.HostTypeFilter)

Aggregations

FilterChain (com.emc.vipr.client.core.filters.FilterChain)2 URI (java.net.URI)2 Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 HostRestRep (com.emc.storageos.model.host.HostRestRep)1 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 BlockVolumeBootVolumeFilter (com.emc.vipr.client.core.filters.BlockVolumeBootVolumeFilter)1 DefaultResourceFilter (com.emc.vipr.client.core.filters.DefaultResourceFilter)1 HostTypeFilter (com.emc.vipr.client.core.filters.HostTypeFilter)1