Blame SOURCES/libvirt-qemuDomainBlockCommit-Move-checks-depending-on-capabilities-after-liveness-check.patch

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