use of com.emc.sa.service.vipr.block.tasks.GetBlockVolumes in project coprhd-controller by CoprHD.
the class BlockStorageUtils method getReplicationGroupFullCopies.
public static Table<URI, String, VolumeRestRep> getReplicationGroupFullCopies(List<NamedRelatedResourceRep> volumeUris) {
// Group volumes by storage system and replication group
Table<URI, String, VolumeRestRep> storageRgToVolumes = HashBasedTable.create();
List<URI> parentVolIds = Lists.newArrayList();
for (NamedRelatedResourceRep volumeUri : volumeUris) {
VolumeRestRep volume = execute(new GetBlockVolume(volumeUri.getId()));
if (volume != null && volume.getProtection() != null && volume.getProtection().getFullCopyRep() != null && volume.getProtection().getFullCopyRep().getAssociatedSourceVolume() != null) {
parentVolIds.add(volume.getProtection().getFullCopyRep().getAssociatedSourceVolume().getId());
}
List<VolumeRestRep> parentVolumes = execute(new GetBlockVolumes(parentVolIds));
if (parentVolumes != null && !parentVolumes.isEmpty()) {
for (VolumeRestRep parentVolume : parentVolumes) {
String rgName = stripRPTargetFromReplicationGroup(parentVolume.getReplicationGroupInstance());
URI storage = parentVolume.getStorageController();
if (!storageRgToVolumes.contains(storage, rgName)) {
storageRgToVolumes.put(storage, rgName, volume);
}
}
}
}
return storageRgToVolumes;
}
Aggregations