]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainDetachDeviceLive: Handle hostevs with unassigned type of address
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Jan 2022 10:05:21 +0000 (11:05 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 27 Jan 2022 13:02:26 +0000 (14:02 +0100)
A <hostdev/> can have <address type='unassigned'/> which means
libvirt manages the device detach from/reattach to the host but
the device is never exposed to the guest. This means that we have
to take a shortcut during hotunplug (e.g. never ask QEMU on the
monitor to detach the device, or never wait for DEVICE_DELETED
event).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index c0c3a8ec9f11333b4d093b5b0bdf353bb3e499a1..409f492ec7dfba8299f8963d7baa9de8cf96f78f 100644 (file)
@@ -6219,6 +6219,10 @@ qemuDomainDetachDeviceLive(virDomainObj *vm,
                            info->addr.pci.slot, info->addr.pci.function);
             return -1;
         }
+    } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED) {
+        /* Unassigned devices are not exposed to QEMU, so remove the device
+         * explicitly, just like if we received DEVICE_DELETED event.*/
+        return qemuDomainRemoveDevice(driver, vm, &detach);
     }
 
     /*