[PATCH] qemuCheckpointCreateXML: Check VM liveness first

Peter Krempa posted 1 patch 4 years ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/9e570a4bccaa09b7636689ff9d974681e1c7a7a4.1585242498.git.pkrempa@redhat.com
src/qemu/qemu_checkpoint.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] qemuCheckpointCreateXML: Check VM liveness first
Posted by Peter Krempa 4 years ago
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>
---
 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 62b6e87b53..3a510c9780 100644
--- a/src/qemu/qemu_checkpoint.c
+++ b/src/qemu/qemu_checkpoint.c
@@ -647,15 +647,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.24.1

Re: [PATCH] qemuCheckpointCreateXML: Check VM liveness first
Posted by Eric Blake 4 years ago
On 3/26/20 12:08 PM, Peter Krempa wrote:
> 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>
> ---
>   src/qemu/qemu_checkpoint.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

We just did the same thing for CheckpointDelete :)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Re: [PATCH] qemuCheckpointCreateXML: Check VM liveness first
Posted by Peter Krempa 4 years ago
On Thu, Mar 26, 2020 at 12:13:52 -0500, Eric Blake wrote:
> On 3/26/20 12:08 PM, Peter Krempa wrote:
> > 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>
> > ---
> >   src/qemu/qemu_checkpoint.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> We just did the same thing for CheckpointDelete :)

I noticed too late that there's another instance :)

> 
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks