Source:
private void removeImages() { List<CinderDisk> cinderDisks = new ArrayList<>(); List <ManagedBlockStorageDisk> managedBlockDisks = new ArrayList<>(); for (final DiskImage source : getSourceImages()) { if (source.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE) { managedBlockDisks.add((ManagedBlockStorageDisk) source); continue; } if (source.getDiskStorageType() == DiskStorageType.CINDER) { cinderDisks.add((CinderDisk) source); continue; } List<DiskImage> images = diskImageDao.getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == ActionType.RemoveSnapshotSingleDiskLive) { commandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest, getSnapshotActionType()), cloneContextAndDetachFromParent()); } else { RemoveSnapshotSingleDiskParameters parameters = buildRemoveSnapshotSingleDiskParameters( source, dest, getSnapshotActionType()); ActionReturnValue actionReturnValueturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), parameters); getTaskIdList().addAll(actionReturnValueturnValue.getInternalVdsmTaskIdList()); } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } if (!cinderDisks.isEmpty()) { handleCinderSnapshotDisks(cinderDisks); } managedBlockDisks.forEach(this::removeManagedBlockSnapshot); }

Target:
private void removeImages() { List<CinderDisk> cinderDisks = new ArrayList<>(); List <ManagedBlockStorageDisk> managedBlockDisks = new ArrayList<>(); for (final DiskImage source : getSourceImages()) { if (source.getDiskStorageType() == DiskStorageType.MANAGED_BLOCK_STORAGE) { managedBlockDisks.add((ManagedBlockStorageDisk) source); continue; } if (source.getDiskStorageType() == DiskStorageType.CINDER) { cinderDisks.add((CinderDisk) source); continue; } List<DiskImage> images = diskImageDao.getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == ActionType.RemoveSnapshotSingleDiskLive) { commandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest, getSnapshotActionType()), cloneContextAndDetachFromParent()); } else { RemoveSnapshotSingleDiskParameters parameters = buildRemoveSnapshotSingleDiskParameters( source, dest, getSnapshotActionType()); ActionReturnValue actionReturnValueturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), parameters); getTaskIdList().addAll(actionReturnValueturnValue.getInternalVdsmTaskIdList()); } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } if (!cinderDisks.isEmpty()) { handleCinderSnapshotDisks(cinderDisks); } managedBlockDisks.forEach(disk -> removeManagedBlockSnapshot(disk)); }