Buggy code:
@ DisableInPrepareMode @ NonTransactiveCommandAttribute ( forceCompensation = true ) public class RemoveVmCommand < T extends RemoveVmParameters > extends VmCommand < T > implements QuotaStorageDependent , TaskHandlerCommand < RemoveVmParameters > { @ Inject private Event < Guid > vmDeleted ; protected RemoveVmCommand ( Guid commandId ) { } public RemoveVmCommand ( T parameters , CommandContext commandContext ) { } public RemoveVmCommand ( T parameters ) { } @ Override protected LockProperties applyLockProperties ( LockProperties lockProperties ) { } @ Override protected void executeVmCommand ( ) { } private boolean removeVm ( ) { } private void removeMemoryVolumes ( ) { } private RemoveMemoryVolumesParameters buildRemoveMemoryVolumesParameters ( String memoryState , Guid vmId ) { } @ Override protected boolean canDoAction ( ) { } @ Override protected void setActionMessageParameters ( ) { } private boolean canRemoveVmWithDetachDisks ( ) { } protected VdcReturnValueBase removeVmImages ( List < DiskImage > images ) { } private RemoveAllVmImagesParameters buildRemoveAllVmImagesParameters ( List < DiskImage > images ) { } @ Override public AuditLogType getAuditLogTypeValue ( ) { } @ Override protected Map < String , Pair < String , String > > getExclusiveLocks ( ) { } protected void removeVmFromDb ( ) { } private void removeLunDisks ( ) { } private Collection < CinderDisk > removeCinderDisks ( ) { Collection < CinderDisk > failedRemoveCinderDisks = null ; if ( getParameters ( ) . isRemoveDisks ( ) ) { List < CinderDisk > cinderDisks = ImagesHandler . filterDisksBasedOnCinder ( RemoveVmCommand . getVm ( ) . getDiskMap ( ) . values ( ) ) ; RemoveAllVmCinderDisksParameters param = new RemoveAllVmCinderDisksParameters ( RemoveVmCommand . getVmId ( ) , cinderDisks ) ; param . setParentHasTasks ( ( ! ( getReturnValue ( ) . getVdsmTaskIdList ( ) . isEmpty ( ) ) ) ) ; Future < VdcReturnValueBase > future = CommandCoordinatorUtil . executeAsyncCommand ( RemoveAllVmCinderDisks , withRootCommandInfo ( param , getActionType ( ) ) , RemoveVmCommand . cloneContextAndDetachFromParent ( ) ) ; try { failedRemoveCinderDisks = future . get ( ) . getActionReturnValue ( ) ; } catch ( InterruptedException | ExecutionException e ) { <START_BUG> failedRemoveCinderDisks . addAll ( cinderDisks ) ; <END_BUG> log . error ( "Exception" , e ) ; } } return failedRemoveCinderDisks ; } @ Override protected void endVmCommand ( ) { } private void processUnremovedDisks ( Collection < ? extends DiskImage > diskImages ) { } @ Override public void addQuotaPermissionSubject ( List < PermissionSubject > quotaPermissionList ) { } @ Override public List < QuotaConsumptionParameter > getQuotaStorageConsumptionParameters ( ) { } public T getParameters ( ) { } public VdcActionType getActionType ( ) { } public VdcReturnValueBase getReturnValue ( ) { } public Guid createTask ( Guid taskId , AsyncTaskCreationInfo asyncTaskCreationInfo , VdcActionType parentCommand , VdcObjectType entityType , Guid ... entityIds ) { } public Guid createTask ( Guid taskId , AsyncTaskCreationInfo asyncTaskCreationInfo , VdcActionType parentCommand ) { } public ArrayList < Guid > getTaskIdList ( ) { } @ Override public void taskEndSuccessfully ( ) { } public void preventRollback ( ) { } public Guid persistAsyncTaskPlaceHolder ( ) { } public Guid persistAsyncTaskPlaceHolder ( String taskKey ) { } }

Fix:
failedRemoveCinderDisks = cinderDisks ;