render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 5155fcbbff955e9c1446b3564af2252a5c15548a Mon Sep 17 00:00:00 2001
Message-Id: <5155fcbbff955e9c1446b3564af2252a5c15548a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 3 Apr 2020 14:32:56 +0200
Subject: [PATCH] qemuCheckpointCreateXML: Check VM liveness first
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Move the liveness check prior to the capability check. If the VM is
offline the capabilities are not initialized and thus we'd report the
wrong error.

https://bugzilla.redhat.com/show_bug.cgi?id=1812531

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 4257c203737e5ef616588e80794cc705a5fb475a)

Note that this patch is backported as a conflict resolution for the bugs
below

https://bugzilla.redhat.com/show_bug.cgi?id=1819755

Message-Id: <94fcc1654f3e2fb2d4c1da07347d686180bac532.1585916255.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_checkpoint.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
index 19822bd74d..16480518fa 100644
--- a/src/qemu/qemu_checkpoint.c
+++ b/src/qemu/qemu_checkpoint.c
@@ -649,15 +649,15 @@ qemuCheckpointCreateXML(virDomainPtr domain,
         update_current = false;
     }
 
-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
+    if (!virDomainObjIsActive(vm)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                       _("incremental backup is not supported yet"));
+                       _("cannot create checkpoint for inactive domain"));
         return NULL;
     }
 
-    if (!virDomainObjIsActive(vm)) {
+    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                       _("cannot create checkpoint for inactive domain"));
+                       _("incremental backup is not supported yet"));
         return NULL;
     }
 
-- 
2.26.0