Source:
protected boolean removeMemoryVolumes(String memVols, VdcActionType parentCommand, boolean startPollingTasks) { List<Guid> guids = GuidUtils.getGuidListFromString(memVols); if (guids.size() == 6) { setStorageDomainId(guids.get(0)); boolean postZero = LinqUtils.filter(getDiskDao().getAllForVm(getVm().getId()), new Predicate<Disk>() { @Override public boolean eval(Disk disk) { return ImagesHandler.shouldWipeAfterDelete( disk.isWipeAfterDelete(), getStorageDomain().getStorageType()); } }).size() > 0; Guid taskId1 = persistAsyncTaskPlaceHolder(parentCommand, DELETE_PRIMARY_IMAGE_TASK_KEY); VDSReturnValue vdsRetValue = runVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(2), postZero, false)); if (!vdsRetValue.getSucceeded()) { return false; } Guid guid1 = createTask(taskId1, vdsRetValue.getCreationInfo(), parentCommand, VdcObjectType.Storage, guids.get(0)); getTaskIdList().add(guid1); Guid taskId2 = persistAsyncTaskPlaceHolder(parentCommand, DELETE_SECONDARY_IMAGES_TASK_KEY); vdsRetValue = runVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(4), postZero, false)); if (!vdsRetValue.getSucceeded()) { if (startPollingTasks) { TaskManagerUtil.startPollingTask(guid1); } return false; } Guid guid2 = createTask(taskId2, vdsRetValue.getCreationInfo(), parentCommand); getTaskIdList().add(guid2); if (startPollingTasks) { TaskManagerUtil.startPollingTask(guid1); TaskManagerUtil.startPollingTask(guid2); } } return true; }

Target:
protected boolean removeMemoryVolumes(String memVols, VdcActionType parentCommand, boolean startPollingTasks) { List<Guid> guids = GuidUtils.getGuidListFromString(memVols); if (guids.size() == 6) { boolean isDiskWithWipeAfterDeleteExist = MemoryImageRemover.isDiskWithWipeAfterDeleteExist(getDiskDao().getAllForVm(getVm().getId())); StorageType storageType = getStorageDomainDAO().get( MemoryImageRemover.getStorageDomainId(guids)).getStorageType(); boolean postZero = ImagesHandler.shouldWipeAfterDelete(isDiskWithWipeAfterDeleteExist, storageType); Guid taskId1 = persistAsyncTaskPlaceHolder(parentCommand, DELETE_PRIMARY_IMAGE_TASK_KEY); VDSReturnValue vdsRetValue = runVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(2), postZero, false)); if (!vdsRetValue.getSucceeded()) { return false; } Guid guid1 = createTask(taskId1, vdsRetValue.getCreationInfo(), parentCommand, VdcObjectType.Storage, guids.get(0)); getTaskIdList().add(guid1); Guid taskId2 = persistAsyncTaskPlaceHolder(parentCommand, DELETE_SECONDARY_IMAGES_TASK_KEY); vdsRetValue = runVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(guids.get(1), guids.get(0), guids.get(4), postZero, false)); if (!vdsRetValue.getSucceeded()) { if (startPollingTasks) { TaskManagerUtil.startPollingTask(guid1); } return false; } Guid guid2 = createTask(taskId2, vdsRetValue.getCreationInfo(), parentCommand); getTaskIdList().add(guid2); if (startPollingTasks) { TaskManagerUtil.startPollingTask(guid1); TaskManagerUtil.startPollingTask(guid2); } } return true; }