From d040fbd1a38b147205c91f55784120426635f5d4 Mon Sep 17 00:00:00 2001 From: Jean-Louis Dupond Date: Thu, 8 Jun 2023 11:43:06 +0200 Subject: [PATCH] Allow Checkpoint removal to fail in some cases in DeleteAllVmCheckpointsCommand If there is checkpoint inconsistency between the checkpoints in the database and those on-disk, then we need to remove all checkpoints on-disk and in the database. But the on-disk removal can fail because the checkpoint is already gone because of some corruption (for example due to an unclean shutdown). Therefor we want to allow DeleteAllVmCheckpointsCommand to continue on failure in some cases. Signed-off-by: Jean-Louis Dupond --- .../storage/backup/DeleteAllVmCheckpointsCommand.java | 5 +++++ .../common/action/DeleteAllVmCheckpointsParameters.java | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/backup/DeleteAllVmCheckpointsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/backup/DeleteAllVmCheckpointsCommand.java index b8bc45fe3a2..75d8b499df8 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/backup/DeleteAllVmCheckpointsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/backup/DeleteAllVmCheckpointsCommand.java @@ -139,4 +139,9 @@ protected Map> getSharedLocks() { return Collections.singletonMap(getParameters().getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } + + @Override + public boolean ignoreChildCommandFailure() { + return getParameters().isForce(); + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/DeleteAllVmCheckpointsParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/DeleteAllVmCheckpointsParameters.java index 9105aa144de..8fcdfa2481a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/DeleteAllVmCheckpointsParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/DeleteAllVmCheckpointsParameters.java @@ -16,6 +16,7 @@ public class DeleteAllVmCheckpointsParameters extends VmOperationParameterBase { @NotNull private List diskImages; private int completedDisksCount; + private boolean force; public DeleteAllVmCheckpointsParameters() { } @@ -24,6 +25,7 @@ public DeleteAllVmCheckpointsParameters(Guid vmId, List diskImages) { super(vmId); this.diskImages = diskImages; completedDisksCount = 0; + force = false; } public List getDiskImages() { @@ -41,4 +43,11 @@ public int getCompletedDisksCount() { public void setCompletedDisksCount(int completedDisksCount) { this.completedDisksCount = completedDisksCount; } + public boolean isForce() { + return force; + } + + public void setForce(boolean force) { + this.force = force; + } }