Search in sources :

Example 1 with VolumeDetail

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

the class TestBlockProviderFilter method filter.

static void filter(ViPRCoreClient client, URI project) {
    List<VolumeRestRep> volumes = listVolumes(client, project);
    List<VolumeDetail> volumeDetails = getVolumeDetails(client, volumes);
    Map<URI, VolumeRestRep> volumeNames = ResourceUtils.mapById(volumes);
    List<AssetOption> options = Lists.newArrayList();
    for (VolumeDetail detail : volumeDetails) {
        boolean localSnapSupported = isLocalSnapshotSupported(detail.vpool);
        boolean isRPTargetVolume = isRPTargetVolume(detail.volume);
        boolean isRPSourceVolume = isRPSourceVolume(detail.volume);
        boolean isInConsistencyGroup = isInConsistencyGroup(detail.volume);
        if (isRPSourceVolume || (localSnapSupported && (!isInConsistencyGroup || isRPTargetVolume))) {
            options.add(BlockProvider.createVolumeOption(client, null, detail.volume, volumeNames));
            System.out.println("\t* " + detail.volume.getName());
        } else {
            System.out.println("\t" + detail.volume.getName());
        }
        String extra = String.format("[localSnapSupported: %s, isRPTargetVolume: %s, isRPSourceVolume: %s, isInConsistencyGroup: %s]", localSnapSupported, isRPTargetVolume, isRPSourceVolume, isInConsistencyGroup);
        System.out.println(String.format("\t\tpersonality:[ %s ], filter:[ %s ]", getVolumePersonality(detail.volume), extra));
    }
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) VolumeDetail(com.emc.sa.asset.providers.BlockProvider.VolumeDetail) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Aggregations

VolumeDetail (com.emc.sa.asset.providers.BlockProvider.VolumeDetail)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 AssetOption (com.emc.vipr.model.catalog.AssetOption)1 URI (java.net.URI)1