[libvirt-users] USB passthrough of all USB-slots to guest

Hi, how can I define passthrough of all USB-slots to a guest with libvirt? With qemu it's very easy: # kvm -usb -usbdevice host:0.* -usbdevice host:1.* -usbdevice host:2.* -usbdevice host:3.* ... This configuration of the VM gets *all* 4 USB-Slots. Every time somewhat USB-device is plugged in the VM gets it. virt-install manpage offers: --host-device 001.003 USB by bus, device (via lsusb). I installed a VM with option --host-device 001.001 according to output of lsusb. The XML-file generated: <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x1d6b'/> <product id='0x0002'/> </source> </hostdev> But no USB device is passed through automatically. I always need virsh attach-device virtualM myusb.xml with exact vendor and product ID. I want to plug in somewhat USB-Stick or other USB stuff without exploring vendor and product id before. Who can help? tia Ekkard

On 05/18/2012 06:04 AM, eGerlach wrote:
Hi,
how can I define passthrough of all USB-slots to a guest with libvirt?
With qemu it's very easy:
# kvm -usb -usbdevice host:0.* -usbdevice host:1.* -usbdevice host:2.* -usbdevice host:3.* ...
This configuration of the VM gets *all* 4 USB-Slots. Every time somewhat USB-device is plugged in the VM gets it.
virt-install manpage offers:
--host-device 001.003 USB by bus, device (via lsusb).
I installed a VM with option --host-device 001.001 according to output of lsusb. The XML-file generated:
<hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x1d6b'/> <product id='0x0002'/> </source> </hostdev> You also may use bus + device to define the above XML, and just need to replace <vendor..../> and <product.../> lines with <address bus='XX' device='XX'/> line. But no USB device is passed through automatically. I always need
virsh attach-device virtualM myusb.xml If you only wirte a myusb.xml rather than running above operation, you can't expect a usb device is assigned to guest, the above method belongs to hot-plugging, the guest must be running status. if your guest is inactive, you can use 'virsh edit' to append the above <hostdev...>...</hostdev> into guest XML configuration then 'virsh start' the guest, the usb device will be assigned to the guest, it belongs to cold-plugging. with exact vendor and product ID. I want to plug in somewhat USB-Stick or other USB stuff without exploring vendor and product id before. I haven't exactly know your mean, as usual, you need to use 'lsusb' or 'virsh nodedev-list --tree' and 'virsh nodedev-dumpxml XXX' to get usb's bus+device or vendor+product information. Who can help?
tia Ekkard
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

* Alex Jia schrieb:
I haven't exactly know your mean, as usual, you need to use 'lsusb' or 'virsh nodedev-list --tree' and 'virsh nodedev-dumpxml XXX' to get usb's bus+device or vendor+product information.
Alex, I wrote in my first posting:
With qemu it's very easy:
# kvm -usb -usbdevice host:0.* -usbdevice host:1.* -usbdevice host:2.* -usbdevice host:3.* ...
Do you know this command in qemu? - A german user starts kvm with that command and *any* USB devices that are plugged in *any* USB slot are automatically connected to the guest VM. He needn't find out vendor and product id before. Is such a function present in libvirt? thx Ekkard

On 05/18/2012 03:16 PM, eGerlach wrote:
* Alex Jia schrieb:
I haven't exactly know your mean, as usual, you need to use 'lsusb' or 'virsh nodedev-list --tree' and 'virsh nodedev-dumpxml XXX' to get usb's bus+device or vendor+product information. Alex, I wrote in my first posting:
With qemu it's very easy:
# kvm -usb -usbdevice host:0.* -usbdevice host:1.* -usbdevice host:2.* -usbdevice host:3.* ... Do you know this command in qemu? - A german user starts kvm with that command and *any* USB devices that are plugged in *any* USB slot are automatically connected to the guest VM. He needn't find out vendor and product id before.
Is such a function present in libvirt? As far as I know, libvirt hasn't similar function can passthrough of all USB-slots to a guest without specifying bus+device or vendor+product. thx Ekkard
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
participants (2)
-
Alex Jia
-
eGerlach