d76c62
From 3d1a4ab1ce9fce88a759e11532b6891903f86a4a Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <3d1a4ab1ce9fce88a759e11532b6891903f86a4a@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Fri, 3 Apr 2020 14:32:57 +0200
d76c62
Subject: [PATCH] qemu: checkpoint: Allow checkpoint redefine for offline VMs
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Skip the liveness and capability checks when redefining checkpoints as
d76c62
we don't need qemu interactions to update the metadata.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Eric Blake <eblake@redhat.com>
d76c62
(cherry picked from commit 135a0b3f7142a8d4f591bb24b3ae7d0f36877bf7)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1819755
d76c62
d76c62
Message-Id: <f1d392d78abde1ffbe1c0244d442bc0ec6aa18a6.1585916255.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_checkpoint.c | 20 +++++++++++---------
d76c62
 1 file changed, 11 insertions(+), 9 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
d76c62
index 16480518fa..34cf122eb3 100644
d76c62
--- a/src/qemu/qemu_checkpoint.c
d76c62
+++ b/src/qemu/qemu_checkpoint.c
d76c62
@@ -649,16 +649,18 @@ qemuCheckpointCreateXML(virDomainPtr domain,
d76c62
         update_current = false;
d76c62
     }
d76c62
 
d76c62
-    if (!virDomainObjIsActive(vm)) {
d76c62
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
d76c62
-                       _("cannot create checkpoint for inactive domain"));
d76c62
-        return NULL;
d76c62
-    }
d76c62
+    if (!redefine) {
d76c62
+        if (!virDomainObjIsActive(vm)) {
d76c62
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
d76c62
+                           _("cannot create checkpoint for inactive domain"));
d76c62
+            return NULL;
d76c62
+        }
d76c62
 
d76c62
-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
d76c62
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
d76c62
-                       _("incremental backup is not supported yet"));
d76c62
-        return NULL;
d76c62
+        if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
d76c62
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
d76c62
+                           _("incremental backup is not supported yet"));
d76c62
+            return NULL;
d76c62
+        }
d76c62
     }
d76c62
 
d76c62
     if (!(def = virDomainCheckpointDefParseString(xmlDesc, driver->xmlopt,
d76c62
-- 
d76c62
2.26.0
d76c62