render / rpms / libvirt

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