render / rpms / libvirt

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