Search in sources :

Example 1 with UnexportedBlockResourceFilter

use of com.emc.sa.asset.providers.BlockProvider.UnexportedBlockResourceFilter in project coprhd-controller by CoprHD.

the class VMWareProvider method getUnassignedDatastores.

@Asset("unassignedBlockDatastore")
@AssetDependencies({ "esxHost", "project" })
public List<AssetOption> getUnassignedDatastores(AssetOptionsContext ctx, URI hostOrClusterId, final URI projectId) {
    ViPRCoreClient client = api(ctx);
    Set<URI> exportedBlockResources = BlockProvider.getExportedVolumes(api(ctx), projectId, hostOrClusterId, null);
    UnexportedBlockResourceFilter<VolumeRestRep> unexportedFilter = new UnexportedBlockResourceFilter<VolumeRestRep>(exportedBlockResources);
    SourceTargetVolumesFilter sourceTargetVolumesFilter = new SourceTargetVolumesFilter();
    BlockVolumeBootVolumeFilter bootVolumeFilter = new BlockVolumeBootVolumeFilter();
    List<VolumeRestRep> volumes = client.blockVolumes().findByProject(projectId, unexportedFilter.and(sourceTargetVolumesFilter).and(bootVolumeFilter.not()));
    return createBlockVolumeDatastoreOptions(volumes, hostOrClusterId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) UnexportedBlockResourceFilter(com.emc.sa.asset.providers.BlockProvider.UnexportedBlockResourceFilter) SourceTargetVolumesFilter(com.emc.vipr.client.core.filters.SourceTargetVolumesFilter) 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)

Aggregations

Asset (com.emc.sa.asset.annotation.Asset)1 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)1 UnexportedBlockResourceFilter (com.emc.sa.asset.providers.BlockProvider.UnexportedBlockResourceFilter)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 BlockVolumeBootVolumeFilter (com.emc.vipr.client.core.filters.BlockVolumeBootVolumeFilter)1 SourceTargetVolumesFilter (com.emc.vipr.client.core.filters.SourceTargetVolumesFilter)1 URI (java.net.URI)1