private String postRPChangeVpoolSteps(Workflow workflow,String waitFor,List<VolumeDescriptor> volumeDescriptors,String taskId){
  List<VolumeDescriptor> rpVolumeDescriptors=VolumeDescriptor.filterByType(volumeDescriptors,new VolumeDescriptor.Type[]{VolumeDescriptor.Type.RP_EXISTING_SOURCE},null);
  if (rpVolumeDescriptors.isEmpty()) {
    return waitFor;
  }
  List<VolumeDescriptor> migratedBlockDataDescriptors=new ArrayList<VolumeDescriptor>();
  List<URI> volumesWithMigration=new ArrayList<URI>();
  if (volumeDescriptors != null) {
    List<VolumeDescriptor> migrateDescriptors=VolumeDescriptor.filterByType(volumeDescriptors,new VolumeDescriptor.Type[]{VolumeDescriptor.Type.VPLEX_MIGRATE_VOLUME},null);
    if (migrateDescriptors != null && !migrateDescriptors.isEmpty()) {
      s_logger.info("Data Migration detected, this is due to a change virtual pool operation on RP+VPLEX or MetroPoint.");
      Iterator<VolumeDescriptor> migrationIter=migrateDescriptors.iterator();
      while (migrationIter.hasNext()) {
        VolumeDescriptor migrationDesc=migrationIter.next();
        Migration migration=s_dbClient.queryObject(Migration.class,migrationDesc.getMigrationId());
        volumesWithMigration.add(migration.getSource());
        Volume migratedVolume=s_dbClient.queryObject(Volume.class,migration.getVolume());
        VolumeDescriptor migratedBlockDataDesc=new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA,migratedVolume.getStorageController(),migratedVolume.getId(),null,migratedVolume.getConsistencyGroup(),migrationDesc.getCapabilitiesValues());
        migratedBlockDataDescriptors.add(migratedBlockDataDesc);
      }
    }
  }
  List<VolumeDescriptor> blockDataDescriptors=new ArrayList<VolumeDescriptor>();
  for (  VolumeDescriptor descr : rpVolumeDescriptors) {
    Volume rpExistingSource=s_dbClient.queryObject(Volume.class,descr.getVolumeURI());
    if (RPHelper.isVPlexVolume(rpExistingSource,s_dbClient)) {
      s_logger.info(String.format("Adding post RP Change Vpool steps for existing VPLEX source volume [%s].",rpExistingSource.getLabel()));
      if (null != rpExistingSource.getAssociatedVolumes()) {
        for (        String assocVolumeId : rpExistingSource.getAssociatedVolumes()) {
          Volume assocVolume=s_dbClient.queryObject(Volume.class,URI.create(assocVolumeId));
          if (volumesWithMigration.contains(assocVolume.getId())) {
            s_logger.info(String.format("Migration exists for [%s] so no need to add this volume to a backing array CG.",assocVolume.getLabel()));
            continue;
          }
          if (NullColumnValueGetter.isNotNullValue(assocVolume.getReplicationGroupInstance())) {
            VolumeDescriptor blockDataDesc=new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA,assocVolume.getStorageController(),assocVolume.getId(),null,rpExistingSource.getConsistencyGroup(),descr.getCapabilitiesValues());
            blockDataDescriptors.add(blockDataDesc);
            assocVolume.setConsistencyGroup(rpExistingSource.getConsistencyGroup());
            s_dbClient.updateObject(assocVolume);
            s_logger.info(String.format("Backing volume [%s] needs to be added to CG [%s] on storage system [%s].",assocVolume.getLabel(),rpExistingSource.getConsistencyGroup(),assocVolume.getStorageController()));
          }
        }
      }
    }
  }
  if (!blockDataDescriptors.isEmpty()) {
    waitFor=_blockDeviceController.addStepsForCreateConsistencyGroup(workflow,waitFor,blockDataDescriptors,"postRPChangeVpoolCreateCG");
    waitFor=_blockDeviceController.addStepsForUpdateConsistencyGroup(workflow,waitFor,blockDataDescriptors,null);
  }
  blockDataDescriptors.addAll(migratedBlockDataDescriptors);
  s_logger.info("Checking for Replica steps");
  waitFor=_replicaDeviceController.addStepsForCreateVolumes(workflow,waitFor,blockDataDescriptors,taskId);
  return waitFor;
}

private String postRPChangeVpoolSteps ( Workflow workflow , String waitFor , List < VolumeDescriptor > volumeDescriptors , String taskId ) { List < VolumeDescriptor > rpVolumeDescriptors = VolumeDescriptor . filterByType ( volumeDescriptors , new VolumeDescriptor . Type [ ] { VolumeDescriptor . Type . RP_EXISTING_SOURCE } , null ) ; if ( rpVolumeDescriptors . isEmpty ( ) ) { return waitFor ; } List < VolumeDescriptor > migratedBlockDataDescriptors = new ArrayList < VolumeDescriptor > ( ) ; List < URI > volumesWithMigration = new ArrayList < URI > ( ) ; if ( volumeDescriptors != null ) { List < VolumeDescriptor > migrateDescriptors = VolumeDescriptor . filterByType ( volumeDescriptors , new VolumeDescriptor . Type [ ] { VolumeDescriptor . Type . VPLEX_MIGRATE_VOLUME } , null ) ; if ( migrateDescriptors != null && ! migrateDescriptors . isEmpty ( ) ) { s_logger . info ( "Data Migration detected, this is due to a change virtual pool operation on RP+VPLEX or MetroPoint." ) ; Iterator < VolumeDescriptor > migrationIter = migrateDescriptors . iterator ( ) ; while ( migrationIter . hasNext ( ) ) { VolumeDescriptor migrationDesc = migrationIter . next ( ) ; Migration migration = s_dbClient . queryObject ( Migration . class , migrationDesc . getMigrationId ( ) ) ; volumesWithMigration . add ( migration . getSource ( ) ) ; Volume migratedVolume = s_dbClient . queryObject ( Volume . class , migration . getVolume ( ) ) ; VolumeDescriptor migratedBlockDataDesc = new VolumeDescriptor ( VolumeDescriptor . Type . BLOCK_DATA , migratedVolume . getStorageController ( ) , migratedVolume . getId ( ) , null , migratedVolume . getConsistencyGroup ( ) , migrationDesc . getCapabilitiesValues ( ) ) ; migratedBlockDataDescriptors . add ( migratedBlockDataDesc ) ; } } } List < VolumeDescriptor > blockDataDescriptors = new ArrayList < VolumeDescriptor > ( ) ; for ( VolumeDescriptor descr : rpVolumeDescriptors ) { Volume rpExistingSource = s_dbClient . queryObject ( Volume . class , descr . getVolumeURI ( ) ) ; if ( RPHelper . isVPlexVolume ( rpExistingSource , s_dbClient ) ) { s_logger . info ( String . format ( "Adding post RP Change Vpool steps for existing VPLEX source volume [%s]." , rpExistingSource . getLabel ( ) ) ) ; if ( null != rpExistingSource . getAssociatedVolumes ( ) ) { for ( String assocVolumeId : rpExistingSource . getAssociatedVolumes ( ) ) { Volume assocVolume = s_dbClient . queryObject ( Volume . class , URI . create ( assocVolumeId ) ) ; if ( volumesWithMigration . contains ( assocVolume . getId ( ) ) ) { s_logger . info ( String . format ( "Migration exists for [%s] so no need to add this volume to a backing array CG." , assocVolume . getLabel ( ) ) ) ; continue ; } if ( NullColumnValueGetter . isNotNullValue ( assocVolume . getReplicationGroupInstance ( ) ) ) { VolumeDescriptor blockDataDesc = new VolumeDescriptor ( VolumeDescriptor . Type . BLOCK_DATA , assocVolume . getStorageController ( ) , assocVolume . getId ( ) , null , rpExistingSource . getConsistencyGroup ( ) , descr . getCapabilitiesValues ( ) ) ; blockDataDescriptors . add ( blockDataDesc ) ; assocVolume . setConsistencyGroup ( rpExistingSource . getConsistencyGroup ( ) ) ; s_dbClient . updateObject ( assocVolume ) ; s_logger . info ( String . format ( "Backing volume [%s] needs to be added to CG [%s] on storage system [%s]." , assocVolume . getLabel ( ) , rpExistingSource . getConsistencyGroup ( ) , assocVolume . getStorageController ( ) ) ) ; } } } } } if ( ! blockDataDescriptors . isEmpty ( ) ) { waitFor = _blockDeviceController . addStepsForCreateConsistencyGroup ( workflow , waitFor , blockDataDescriptors , "postRPChangeVpoolCreateCG" ) ; waitFor = _blockDeviceController . addStepsForUpdateConsistencyGroup ( workflow , waitFor , blockDataDescriptors , null ) ; } blockDataDescriptors . addAll ( migratedBlockDataDescriptors ) ; s_logger . info ( "Checking for Replica steps" ) ; waitFor = _replicaDeviceController . addStepsForCreateVolumes ( workflow , waitFor , blockDataDescriptors , taskId ) ; return waitFor ; }
needed to perform post change vpool operations on rp volumes .
