I’m forwarding a host USB hub using this virsh config:
<hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x13' slot='0x00' function='0x3'/> </source> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </hostdev>
This works perfectly. However, I want to be able to hot attach/detach this USB hub from the VM at any time. In theory this should work:
$ virsh detach-device my-vm-name pci-root-usb-hub.xml Device detached successfully
Ok, looks promising, however the PCI device hasn’t actually been detached. I can still see my webcam and move my mouse around inside the VM. If I run the command again:
$ virsh detach-device my-vm-name pci-root-usb-hub.xml error: Failed to detach device from pci-root-usb-hub.xml error: internal error: unable to execute QEMU command 'device_del': Device hostdev2 is already in the process of unplug
And it seems to be frozen there. I’m unable to actually detach the PCI device from the VM without shutting the VM down.
I’m unable to find any errors in
qemu/my-vm-name.log. Is there an obvious reason why this is not working?
- Host OS: Arch Linux (kernel 5.13.12)
- Guest OS: Windows 10