libvirt/SOURCES/libvirt-qemu-checkpoint-Store-whether-deleted-checkpoint-is-current-in-a-variable.patch
2021-10-08 13:11:20 +00:00

57 lines
2.3 KiB
Diff

From f259cc67ba390d0d88f2db616514503714462742 Mon Sep 17 00:00:00 2001
Message-Id: <f259cc67ba390d0d88f2db616514503714462742@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:49 +0100
Subject: [PATCH] qemu: checkpoint: Store whether deleted checkpoint is current
in a variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Avoid two computations by using a boolean.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 606dc66b0958fe3545a318ae9bc6a62a67786378)
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
Message-Id: <d2da4b96b189a8ac30f8be642d854a8a71e35083.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_checkpoint.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
index 2fa5c1ae00..d13d4c2a37 100644
--- a/src/qemu/qemu_checkpoint.c
+++ b/src/qemu/qemu_checkpoint.c
@@ -117,6 +117,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
size_t i, j;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
g_autofree char *chkFile = NULL;
+ bool chkcurrent = chk == virDomainCheckpointGetCurrent(vm->checkpoints);
if (!metadata_only && !virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
@@ -172,7 +173,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, node, disk->bitmap) < 0)
return -1;
- if (chk == virDomainCheckpointGetCurrent(vm->checkpoints)) {
+ if (chkcurrent) {
if (qemuMonitorTransactionBitmapEnable(actions, node, disk2->bitmap) < 0)
return -1;
}
@@ -192,7 +193,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver,
return -1;
}
- if (chk == virDomainCheckpointGetCurrent(vm->checkpoints)) {
+ if (chkcurrent) {
virDomainCheckpointSetCurrent(vm->checkpoints, NULL);
if (update_parent && parent) {
virDomainCheckpointSetCurrent(vm->checkpoints, parent);
--
2.25.0