Blame SOURCES/libvirt-virDomainCheckpointRedefinePrep-Set-current-checkpoint-if-there-isn-t-any.patch

fbe740
From da9c0f143d7c917c98b7352be7954e8b2489aa9e Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <da9c0f143d7c917c98b7352be7954e8b2489aa9e@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Fri, 3 Apr 2020 14:32:58 +0200
fbe740
Subject: [PATCH] virDomainCheckpointRedefinePrep: Set 'current' checkpoint if
fbe740
 there isn't any
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
When redefining checkpoints from scratch we'd not set the 'current'
fbe740
checkpoint if there wasn't any. This meant that the code wasn't ever
fbe740
able to set a 'current' checkpoint as any other one looks up if the
fbe740
parent of the redefined checkpoint is current.
fbe740
fbe740
Since the backup code then requires the current checkpoint to start the
fbe740
lookup we'd not be able to perform a backup after restoring the
fbe740
checkpoint hierarchy.
fbe740
fbe740
Reported-by: Eyal Shenitzky <eshenitz@redhat.com>
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Eric Blake <eblake@redhat.com>
fbe740
(cherry picked from commit 9428c4609c7b23b3afe89566dca9ac237256d3df)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1819755
fbe740
fbe740
Message-Id: <53c1d685b40f0f540eeb4d15a17e308aab2bf648.1585916255.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/conf/checkpoint_conf.c | 4 ++++
fbe740
 1 file changed, 4 insertions(+)
fbe740
fbe740
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
fbe740
index 26bcfc16b7..d557fada49 100644
fbe740
--- a/src/conf/checkpoint_conf.c
fbe740
+++ b/src/conf/checkpoint_conf.c
fbe740
@@ -550,6 +550,10 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
fbe740
             *update_current = true;
fbe740
     }
fbe740
 
fbe740
+    /* set the first redefined checkpoint as current */
fbe740
+    if (virDomainCheckpointGetCurrent(vm->checkpoints) == NULL)
fbe740
+        *update_current = true;
fbe740
+
fbe740
     other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name);
fbe740
     if (other) {
fbe740
         otherdef = virDomainCheckpointObjGetDef(other);
fbe740
-- 
fbe740
2.26.0
fbe740