render / rpms / libvirt

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