[PATCH] qemu: blockcommit: Fix placement of qemuDomainDiskBlockJobIsSupported

Peter Krempa pkrempa at redhat.com
Fri Jun 5 10:22:52 UTC 2020


Commit b50a8354f6d added call to qemuDomainDiskBlockJobIsSupported prior
to filling the 'disk' variable resulting in a crash when attempting a
block commit.

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

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dd9ae30bb5..88517ba6a7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18504,9 +18504,6 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (virDomainObjCheckActive(vm) < 0)
         goto endjob;

-    if (!qemuDomainDiskBlockJobIsSupported(vm, disk))
-        goto endjob;
-
     blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);

     /* Convert bandwidth MiB to bytes, if necessary */
@@ -18523,6 +18520,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (!(disk = qemuDomainDiskByName(vm->def, path)))
         goto endjob;

+    if (!qemuDomainDiskBlockJobIsSupported(vm, disk))
+        goto endjob;
+
     if (virStorageSourceIsEmpty(disk->src)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("disk %s has no source file to be committed"),
-- 
2.26.2




More information about the libvir-list mailing list