render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From b482f451983e159f3e9752c8d4f2f5d36e6e9dce Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <b482f451983e159f3e9752c8d4f2f5d36e6e9dce@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Mon, 16 Mar 2020 22:12:19 +0100
fbe740
Subject: [PATCH] qemuDomainBlockCommit: Move checks depending on capabilities
fbe740
 after liveness check
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Since capabilities are not present for inactive VMs we'd report that we
fbe740
don't support '--delete' or committing while checkpoints exist rather
fbe740
than the proper error.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Eric Blake <eblake@redhat.com>
fbe740
(cherry picked from commit d4b5bb5d56e0ba346a01c605b7316f4394907115)
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
fbe740
Message-Id: <74ee257babd3eb042be2fcc5d3a101d503b99ad2.1584391727.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_driver.c | 18 +++++++++---------
fbe740
 1 file changed, 9 insertions(+), 9 deletions(-)
fbe740
fbe740
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
fbe740
index 441bb02b6b..062e028b28 100644
fbe740
--- a/src/qemu/qemu_driver.c
fbe740
+++ b/src/qemu/qemu_driver.c
fbe740
@@ -18738,9 +18738,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
fbe740
     if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0)
fbe740
         goto cleanup;
fbe740
 
fbe740
-    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
fbe740
-        goto cleanup;
fbe740
-
fbe740
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
fbe740
         goto cleanup;
fbe740
 
fbe740
@@ -18749,12 +18746,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
fbe740
 
fbe740
     blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
fbe740
 
fbe740
-    if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) {
fbe740
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
fbe740
-                       _("deleting committed images is not supported by this VM"));
fbe740
-        goto endjob;
fbe740
-    }
fbe740
-
fbe740
     /* Convert bandwidth MiB to bytes, if necessary */
fbe740
     if (!(flags & VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)) {
fbe740
         if (speed > LLONG_MAX >> 20) {
fbe740
@@ -18779,6 +18770,15 @@ qemuDomainBlockCommit(virDomainPtr dom,
fbe740
     if (qemuDomainDiskBlockJobIsActive(disk))
fbe740
         goto endjob;
fbe740
 
fbe740
+    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
fbe740
+        goto endjob;
fbe740
+
fbe740
+    if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) {
fbe740
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
fbe740
+                       _("deleting committed images is not supported by this VM"));
fbe740
+        goto endjob;
fbe740
+    }
fbe740
+
fbe740
     if (!top || STREQ(top, disk->dst))
fbe740
         topSource = disk->src;
fbe740
     else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 ||
fbe740
-- 
fbe740
2.25.1
fbe740