private void addVolumesToCG(URI cgURI,Collection<URI> vplexVolumeURIList,String cgName,String clusterName,VPlexApiClient client){
  List<String> vplexVolumeNames=new ArrayList<String>();
  List<Volume> vplexVolumes=new ArrayList<Volume>();
  for (  URI vplexVolumeURI : vplexVolumeURIList) {
    Volume vplexVolume=getDataObject(Volume.class,vplexVolumeURI,dbClient);
    if (vplexVolume == null || vplexVolume.getInactive()) {
      log.error(String.format("skipping null or inactive vplex volume %s",vplexVolumeURI.toString()));
      continue;
    }
    vplexVolume.setConsistencyGroup(cgURI);
    vplexVolumes.add(vplexVolume);
    log.info(String.format("Adding VPLEX volume: %s (device label %s) to CG %s on cluster %s",vplexVolume.getNativeId(),vplexVolume.getDeviceLabel(),cgName,clusterName));
    vplexVolumeNames.add(vplexVolume.getDeviceLabel());
  }
  client.addVolumesToConsistencyGroup(cgName,vplexVolumeNames);
  log.info("Added volumes to consistency group.");
  dbClient.updateObject(vplexVolumes);
}

private void addVolumesToCG ( URI cgURI , Collection < URI > vplexVolumeURIList , String cgName , String clusterName , VPlexApiClient client ) { List < String > vplexVolumeNames = new ArrayList < String > ( ) ; List < Volume > vplexVolumes = new ArrayList < Volume > ( ) ; for ( URI vplexVolumeURI : vplexVolumeURIList ) { Volume vplexVolume = getDataObject ( Volume . class , vplexVolumeURI , dbClient ) ; if ( vplexVolume == null || vplexVolume . getInactive ( ) ) { log . error ( String . format ( "skipping null or inactive vplex volume %s" , vplexVolumeURI . toString ( ) ) ) ; continue ; } vplexVolume . setConsistencyGroup ( cgURI ) ; vplexVolumes . add ( vplexVolume ) ; log . info ( String . format ( "Adding VPLEX volume: %s (device label %s) to CG %s on cluster %s" , vplexVolume . getNativeId ( ) , vplexVolume . getDeviceLabel ( ) , cgName , clusterName ) ) ; vplexVolumeNames . add ( vplexVolume . getDeviceLabel ( ) ) ; } client . addVolumesToConsistencyGroup ( cgName , vplexVolumeNames ) ; log . info ( "Added volumes to consistency group." ) ; dbClient . updateObject ( vplexVolumes ) ; }
adds a list of volumes to a vplex cg
