USB Auto mapping to Windows VM under KVM does not work
Let me first say, that it does work for Linux guest. It doesn’t work on Windows guest because there is a know bug (/issue) with the default hardware layout – made of i440FX BIOS. VirtManager would not allow us to replace the settings, so we need to create the VM ourselves using XML. You can export your XML settings (of an existing VM) using the command
virsh dumpxml> /tmp/VM_NAME.xml
There are relevant fields there which you might want to save for later, like MAC addresses, network settings, and so on.
You can use this XML file to build your VM anew. Note that you will want to modify the network settings, the name and the UUID. Also – you will need a newer QEMU command (through the package qemu-system-x86), you can find in the Centos updates repository, . It has been providing me with /usr/bin/qemu-system-x86_64 command, which I am using, instead of the default qemu command used by default by VirtManager.
My Windows VM XML file (as a reference you can copy and use) is provided below. Major modifications are required to the hardware settings of the Windows VM – moving from PCI to PCIE, changing from IDE to SATA or VirtIO – and the provided XML gives a good reference of how this file should look like. This was taken from a machine tested to allow USB hot-add/remove via the method provided in my previous post.
Windows
9a10dc43-5c39-411d-8dc9-f6c6b849d212
4194304
4194304
2
/machine
hvm
destroy
restart
destroy
/usr/bin/qemu-system-x86_64
+107:+107
Now just import the VM using
virsh define /tmp/NEW_MACHINE.xml
and your changes are available via VirtManager, where you can edit (some of them).