[PATCH] qemu: hotplug: Reorder setup of disk backend metadata

Peter Krempa posted 1 patch 1 year, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/61e7a0c70283501ea56886a4d8e36126c3a5479e.1683292531.git.pkrempa@redhat.com
src/qemu/qemu_hotplug.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] qemu: hotplug: Reorder setup of disk backend metadata
Posted by Peter Krempa 1 year, 5 months ago
The regular VM startup code first calls the setup of the disk backing
chain as defined in the XML and then calls the function to load the
rest of the backing chain from the image metadata. The hotplug code
did it the other way around, thus causing a failure when attempting
to attach a QCOW2 image via FD passing.

Reorder the hotplug code to have the same order.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2193315
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_hotplug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8c14540275..54b5a2c2c9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -921,9 +921,6 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
     if (virDomainDiskTranslateSourcePool(disk) < 0)
         goto cleanup;

-    if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL) < 0)
-        goto cleanup;
-
     for (i = 0; i < vm->def->ndisks; i++) {
         if (virDomainDiskDefCheckDuplicateInfo(vm->def->disks[i], disk) < 0)
             goto cleanup;
@@ -1007,6 +1004,9 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
     if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0)
         goto cleanup;

+    if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL) < 0)
+        goto cleanup;
+
     if (qemuHotplugAttachManagedPR(vm, disk->src, VIR_ASYNC_JOB_NONE) < 0)
         goto cleanup;

-- 
2.40.0
Re: [PATCH] qemu: hotplug: Reorder setup of disk backend metadata
Posted by Ján Tomko 1 year, 5 months ago
On a Friday in 2023, Peter Krempa wrote:
>The regular VM startup code first calls the setup of the disk backing
>chain as defined in the XML and then calls the function to load the
>rest of the backing chain from the image metadata. The hotplug code
>did it the other way around, thus causing a failure when attempting
>to attach a QCOW2 image via FD passing.
>
>Reorder the hotplug code to have the same order.
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2193315
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_hotplug.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano