render / rpms / libvirt

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