Source:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge() || isInMergeRetry()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes"); } else if (isMerge()) { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); RemoveSnapshotSingleDiskParameters removeSnapshotSingleDiskParameters = (RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters(); removeSnapshotSingleDiskParameters.setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); removeSnapshotSingleDiskParameters.setInRetryDestroyImage(true); persistCommand(getParameters().getParentCommand(), true); } setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); }

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge() || isMergeRetry()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes"); } else if (isMerge()) { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); RemoveSnapshotSingleDiskParameters removeSnapshotSingleDiskParameters = (RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters(); removeSnapshotSingleDiskParameters.setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); removeSnapshotSingleDiskParameters.setRetryDestroyImage(true); persistCommand(getParameters().getParentCommand(), true); } setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); }