[libvirt] [PATCH] qemu: backup: Move capability check after inactive check

Peter Krempa pkrempa at redhat.com
Mon Jan 6 11:36:57 UTC 2020


Inactive VM doesn't have qemuCaps set thus we'd never properly report
that VM backups are supported only for running VMs.

Move the capability check after the active check.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_backup.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index c0445e0869..86b10a2b8a 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -750,12 +750,6 @@ qemuBackupBegin(virDomainObjPtr vm,

     virCheckFlags(VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL, -1);

-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                       _("incremental backup is not supported yet"));
-        return -1;
-    }
-
     if (!(def = virDomainBackupDefParseString(backupXML, priv->driver->xmlopt, 0)))
         return -1;

@@ -793,6 +787,12 @@ qemuBackupBegin(virDomainObjPtr vm,
         goto endjob;
     }

+    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("incremental backup is not supported yet"));
+        goto endjob;
+    }
+
     if (priv->backup) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("another backup job is already running"));
-- 
2.24.1




More information about the libvir-list mailing list