Skip to content

Commit

Permalink
Allow Checkpoint removal to fail in some cases in DeleteAllVmCheckpoi…
Browse files Browse the repository at this point in the history
…ntsCommand

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 <[email protected]>
  • Loading branch information
dupondje authored and sandrobonazzola committed Oct 4, 2024
1 parent 2c818d8 commit d040fbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,9 @@ protected Map<String, Pair<String, String>> 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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class DeleteAllVmCheckpointsParameters extends VmOperationParameterBase {
@NotNull
private List<DiskImage> diskImages;
private int completedDisksCount;
private boolean force;

public DeleteAllVmCheckpointsParameters() {
}
Expand All @@ -24,6 +25,7 @@ public DeleteAllVmCheckpointsParameters(Guid vmId, List<DiskImage> diskImages) {
super(vmId);
this.diskImages = diskImages;
completedDisksCount = 0;
force = false;
}

public List<DiskImage> getDiskImages() {
Expand All @@ -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;
}
}

0 comments on commit d040fbd

Please sign in to comment.