Source:
public void attemptResolution() { Set<Guid> images; if (vmDynamicDao.get(getParameters().getVmId()).getStatus().isNotRunning()) { StoragePool pool = storagePoolDao.get(getParameters().getStoragePoolId()); if (pool.getSpmVdsId() == null || pool.getStatus() != StoragePoolStatus.Up) { log.info("VM down, waiting on SPM election to resolve Live Merge"); setSucceeded(true); return; } else { log.error("VM is not running, proceeding with Live Merge recovery"); images = getVolumeChainFromRecovery(); } } else { images = getVolumeChain(); } if (images == null || images.isEmpty()) { log.error("Failed to retrieve images list of VM {}. Retrying ...", getParameters().getVmId()); setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE_STATUS); return; } Guid topImage = getParameters().getTopImage().getImageId(); if (images.contains(topImage)) { log.error("Failed to live merge. Top volume {}: is still in qemu chain: {}", topImage, images); setCommandStatus(CommandStatus.FAILED); return; } if (!images.contains(getParameters().getBaseImage().getImageId())) { addCustomValue("SnapshotName", snapshotDao.get(getParameters().getBaseImage().getSnapshotId()).getDescription()); addCustomValue("BaseVolumeId", getParameters().getBaseImage().getImageId().toString()); auditLog(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_BASE_IMAGE_NOT_FOUND); setCommandStatus(CommandStatus.FAILED); return; } log.info("Successfully removed volume: from the chain", topImage); log.info("Volume merge type '{}'", VmBlockJobType.COMMIT.name()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, Collections.singleton(topImage)); getReturnValue().setActionReturnValue(returnValue); setSucceeded(true); persistCommand(getParameters().getParentCommand(), true); setCommandStatus(CommandStatus.SUCCEEDED); }

Target:
public void attemptResolution() { Set<Guid> images; if (vmDynamicDao.get(getParameters().getVmId()).getStatus().isNotRunning()) { StoragePool pool = storagePoolDao.get(getParameters().getStoragePoolId()); if (pool.getSpmVdsId() == null || pool.getStatus() != StoragePoolStatus.Up) { log.info("VM down, waiting on SPM election to resolve Live Merge"); setSucceeded(true); return; } else { log.error("VM is not running, proceeding with Live Merge recovery"); images = getVolumeChainFromRecovery(); } } else { images = getVolumeChain(); } if (images == null || images.isEmpty()) { log.error("Failed to retrieve images list of VM {}. Retrying ...", getParameters().getVmId()); setCommandStatus(CommandStatus.SUCCEEDED); setSucceeded(true); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE_STATUS); return; } Guid topImage = getParameters().getTopImage().getImageId(); if (images.contains(topImage)) { log.error("Failed to live merge. Top volume is still in qemu chain {}", topImage, images); setCommandStatus(CommandStatus.FAILED); return; } if (!images.contains(getParameters().getBaseImage().getImageId())) { addCustomValue("SnapshotName", snapshotDao.get(getParameters().getBaseImage().getSnapshotId()).getDescription()); addCustomValue("BaseVolumeId", getParameters().getBaseImage().getImageId().toString()); auditLog(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_BASE_IMAGE_NOT_FOUND); setCommandStatus(CommandStatus.FAILED); return; } log.info("Successfully removed volume from the chain", topImage); log.info("Volume merge type '{}'", VmBlockJobType.COMMIT.name()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, Collections.singleton(topImage)); getReturnValue().setActionReturnValue(returnValue); setSucceeded(true); persistCommand(getParameters().getParentCommand(), true); setCommandStatus(CommandStatus.SUCCEEDED); }