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