Buggy code:
@ Deprecated private void prepareBackendVolumeForMigration ( StorageSystem vplexSystem , Volume virtualVolume , Volume sourceVolume , VirtualArray varray , VirtualPool vpool , Long capacity , String taskId , List < URI > newVolumes , Map < URI , URI > migrationMap , Map < URI , URI > poolVolumeMap ) { } private List < VolumeDescriptor > createBackendVolumeMigrationDescriptors ( StorageSystem vplexSystem , Volume virtualVolume , Volume sourceVolume , VirtualArray varray , VirtualPool vpool , Long capacity , String taskId , List < Recommendation > recommendations , boolean isHA , VirtualPoolCapabilityValuesWrapper capabilities ) { URI sourceVolumeURI = null ; Project targetProject = null ; String targetLabel = null ; if ( sourceVolume != null ) { sourceVolumeURI = sourceVolume . getId ( ) ; targetProject = _dbClient . queryObject ( Project . class , sourceVolume . getProject ( ) . getURI ( ) ) ; targetLabel = sourceVolume . getLabel ( ) ; if ( ! ( targetLabel . endsWith ( VPlexBlockServiceApiImpl . MIGRATION_LABEL_SUFFIX ) ) ) { targetLabel += VPlexBlockServiceApiImpl . MIGRATION_LABEL_SUFFIX ; } else { targetLabel = targetLabel . substring ( 0 , ( ( targetLabel . length ( ) ) - 1 ) ) ; } } else { targetProject = VPlexBlockServiceApiImpl . getVplexProject ( vplexSystem , _dbClient , _tenantsService ) ; targetLabel = virtualVolume . getLabel ( ) ; if ( virtualVolume . getVirtualArray ( ) . equals ( varray . getId ( ) ) ) { targetLabel += VPlexBlockServiceApiImpl . SRC_BACKEND_VOL_LABEL_SUFFIX ; } else { targetLabel += VPlexBlockServiceApiImpl . HA_BACKEND_VOL_LABEL_SUFFIX ; } } Set < URI > requestedVPlexSystems = new HashSet < URI > ( ) ; requestedVPlexSystems . add ( vplexSystem . getId ( ) ) ; URI cgURI = null ; if ( capabilities != null ) { final BlockConsistencyGroup consistencyGroup = ( ( capabilities . getBlockConsistencyGroup ( ) ) == null ) ? null : _dbClient . queryObject ( BlockConsistencyGroup . class , capabilities . getBlockConsistencyGroup ( ) ) ; if ( ( consistencyGroup != null ) && ( ( ! ( consistencyGroup . created ( ) ) ) || ( consistencyGroup . getTypes ( ) . contains ( LOCAL . toString ( ) ) ) ) ) { cgURI = consistencyGroup . getId ( ) ; } } else { capabilities = new VirtualPoolCapabilityValuesWrapper ( ) ; capabilities . put ( SIZE , capacity ) ; capabilities . put ( RESOURCE_COUNT , new Integer ( 1 ) ) ; } boolean premadeRecs = false ; if ( ( recommendations == null ) || ( recommendations . isEmpty ( ) ) ) { recommendations = getBlockScheduler ( ) . scheduleStorage ( varray , requestedVPlexSystems , null , vpool , false , null , null , capabilities ) ; if ( recommendations . isEmpty ( ) ) { throw badRequests . noStorageFoundForVolumeMigration ( vpool . getId ( ) , varray . getId ( ) , sourceVolumeURI ) ; } VPlexBlockServiceApiImpl . s_logger . info ( "Got<seq2seq4repair_space>recommendation" ) ; } else { premadeRecs = true ; } int recIndex = ( premadeRecs && isHA ) ? 1 : 0 ; URI targetStorageSystem = recommendations . get ( recIndex ) . getSourceStorageSystem ( ) ; URI targetStoragePool = recommendations . get ( recIndex ) . getSourceStoragePool ( ) ; Volume targetVolume = VPlexBlockServiceApiImpl . prepareVolumeForRequest ( capacity , targetProject , varray , vpool , targetStorageSystem , targetStoragePool , targetLabel , CREATE_BLOCK_VOLUME , taskId , _dbClient ) ; if ( cgURI == null ) { if ( ( sourceVolume != null ) && ( ! ( NullColumnValueGetter . isNullURI ( sourceVolume . getConsistencyGroup ( ) ) ) ) ) { cgURI = sourceVolume . getConsistencyGroup ( ) ; targetVolume . setConsistencyGroup ( cgURI ) ; } } <START_BUG> if ( ( sourceVolume != null ) && ( ! ( NullColumnValueGetter . isNotNullValue ( sourceVolume . getReplicationGroupInstance ( ) ) ) ) ) { <END_BUG> targetVolume . setReplicationGroupInstance ( sourceVolume . getReplicationGroupInstance ( ) ) ; } targetVolume . addInternalFlags ( INTERNAL_OBJECT ) ; _dbClient . persistObject ( targetVolume ) ; VPlexBlockServiceApiImpl . s_logger . info ( "Prepared<seq2seq4repair_space>volume<seq2seq4repair_space>{}" , targetVolume . getId ( ) ) ; URI targetVolumeURI = targetVolume . getId ( ) ; List < VolumeDescriptor > descriptors = new ArrayList < VolumeDescriptor > ( ) ; descriptors . add ( new VolumeDescriptor ( Type . BLOCK_DATA , targetStorageSystem , targetVolumeURI , targetStoragePool , cgURI , capabilities , capacity ) ) ; Migration migration = prepareMigration ( virtualVolume . getId ( ) , sourceVolumeURI , targetVolumeURI , taskId ) ; descriptors . add ( new VolumeDescriptor ( Type . VPLEX_MIGRATE_VOLUME , targetStorageSystem , targetVolumeURI , targetStoragePool , cgURI , migration . getId ( ) , capabilities ) ) ; VPlexBlockServiceApiImpl . s_logger . info ( "Prepared<seq2seq4repair_space>migration<seq2seq4repair_space>{}." , migration . getId ( ) ) ; return descriptors ; } public static Volume prepareVolumeForRequest ( Long size , Project project , VirtualArray neighborhood , VirtualPool vpool , URI storageSystemURI , URI storagePoolURI , String label , ResourceOperationTypeEnum opType , String token , DbClient dbClient ) { } public Migration prepareMigration ( URI virtualVolumeURI , URI sourceURI , URI targetURI , String token ) { } @ Override public StorageSystemConnectivityList getStorageSystemConnectivity ( StorageSystem storageSystem ) { } @ Override public void verifyVarrayChangeSupportedForVolumeAndVarray ( Volume volume , VirtualArray newVarray ) throws APIException { } @ Override public void changeVirtualArrayForVolumes ( List < Volume > volumes , BlockConsistencyGroup cg , List < Volume > cgVolumes , VirtualArray newVirtualArray , String taskId ) throws InternalException { } private List < VolumeDescriptor > createVolumeDescriptorsForVarrayChange ( List < Volume > volumes , VirtualArray newVarray , String taskId ) { } @ Override public void verifyVolumeExpansionRequest ( Volume vplexVolume , long newSize ) { } @ Override public void expandVolume ( Volume vplexVolume , long newSize , String taskId ) throws InternalException { } private boolean isNativeVolumeExpansionSupported ( Volume vplexVolume , Long newSize ) { } @ Override public TaskResourceRep deleteConsistencyGroup ( StorageSystem device , BlockConsistencyGroup consistencyGroup , String task ) throws ControllerException { }

Fix:
if ( ( sourceVolume != null ) && ( NullColumnValueGetter . isNotNullValue ( sourceVolume . getReplicationGroupInstance ( ) ) ) ) {