public Map<URI,List<URI>> addTargetVolumeSnapshots(){
  List<URI> blockSnapshots=Lists.newArrayList();
  Map<URI,List<URI>> snapshotsMap=new HashMap<>();
  URI targetCG=null;
  for (  URI volumeId : uris(volumeIds)) {
    List<URI> targets=getTargets(volumeId);
    for (    URI target : targets) {
      if (targetCG == null) {
        targetCG=getConsistencyGroup(target);
      }
      List<URI> snapshots=getSnapshots(target);
      blockSnapshots.addAll(snapshots);
      snapshotsMap.put(target,snapshots);
    }
  }
  if (!blockSnapshots.isEmpty() && targetCG != null) {
    BlockStorageUtils.addVolumesToConsistencyGroup(targetCG,blockSnapshots);
  }
  return snapshotsMap;
}

public Map < URI , List < URI > > addTargetVolumeSnapshots ( ) { List < URI > blockSnapshots = Lists . newArrayList ( ) ; Map < URI , List < URI > > snapshotsMap = new HashMap < > ( ) ; URI targetCG = null ; for ( URI volumeId : uris ( volumeIds ) ) { List < URI > targets = getTargets ( volumeId ) ; for ( URI target : targets ) { if ( targetCG == null ) { targetCG = getConsistencyGroup ( target ) ; } List < URI > snapshots = getSnapshots ( target ) ; blockSnapshots . addAll ( snapshots ) ; snapshotsMap . put ( target , snapshots ) ; } } if ( ! blockSnapshots . isEmpty ( ) && targetCG != null ) { BlockStorageUtils . addVolumesToConsistencyGroup ( targetCG , blockSnapshots ) ; } return snapshotsMap ; }
adds all target volumes ' snapshots to the target consistency group
