]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: hotplug: Reorder setup of disk backend metadata
authorPeter Krempa <pkrempa@redhat.com>
Fri, 5 May 2023 12:43:17 +0000 (14:43 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 5 May 2023 14:32:29 +0000 (16:32 +0200)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index 8c1454027513521e39644a1b6db81060beafb4db..54b5a2c2c9d4664c7413ab5bbb8a71ccfb36ed5c 100644 (file)
@@ -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;