USB 2.0 device passthrough

438 views
Skip to first unread message

Roman Vrublevskiy

unread,
Apr 25, 2015, 5:57:30 AM4/25/15
to gan...@googlegroups.com
Dear all,

tell me please is it possible to passthrough usb 2.0 device in ganeti?
If I understand correctly, we need to emulate usb EHCI host controller but all my attempts ended without success.
Any help greatly appreciated.

Helga Velroyen

unread,
Apr 27, 2015, 4:50:26 AM4/27/15
to gan...@googlegroups.com
Hi!

what hypervisor do you use? And did you try it with a VM that not managed by Ganeti but using the same hypervisor version? (To see if it is a hypervisor issue or a Ganeti issue)

Cheers,
Helga

Roman Vrublevskiy

unread,
Apr 29, 2015, 5:25:41 AM4/29/15
to gan...@googlegroups.com
Hi!

I use KVM and was pretty sure that it's possible to emulate usb ehci with it. At least it was possible with qemu-kvm which as far as I know merged in qemu-system-x86-64.

Now I'm trying to make it without ganeti. Will post results here.

Roman Vrublevskiy

unread,
Apr 29, 2015, 7:44:45 AM4/29/15
to gan...@googlegroups.com
Yep, it works on the same machine with the following parameters:

qemu-system-x86_64 -enable-kvm -hda vdisk.img -boot d -m 2048 --vnc :7154 -usbdevice tablet \
-device usb-ehci \
-device usb-host,vendorid=0x8564,productid=0x1000

Helga Velroyen

unread,
Apr 29, 2015, 8:13:48 AM4/29/15
to gan...@googlegroups.com
What is the commandline that you used with ganeti to achieve this?

The man page of gnt-instance says about usb_devices. It seems ganeti only supports the passthrough of the parameters to "-usbdevice" and not "-device".

usb_devices
    Valid for the KVM hypervisor.

    Space separated list of usb devices. These can be emulated devices
    or passthrough ones, and each one gets passed to kvm with its own
    ``-usbdevice`` option. See the **qemu**\(1) manpage for the syntax
    of the possible components. Note that values set with this 
    parameter are split on a space character and currently don't support
    quoting. For backwards compatibility reasons, the RAPI interface keeps
    accepting comma separated lists too. 

Unfortunately, I currently don't have a KVM cluster at hand to test it, so I hope someone else on this list can way in.

Cheers,
Helga

Thomas Ott

unread,
Apr 29, 2015, 10:27:37 AM4/29/15
to gan...@googlegroups.com
Hi,

I use KVM as Hypervisor und Ganeti 2.12.
For passing a USB Dongle I modified the "kvm:usb_devices" with "host:<vendorid>:<productid>". After restarting the Instance the Dongle appears. And if I drop the dongle and reinsert it, it reappears. So I'm happy :-)

Greetz,
Thomas

Roman Vrublevskiy

unread,
May 16, 2015, 5:48:04 AM5/16/15
to gan...@googlegroups.com
If we use usb_devices=host:XXXX:YYYY ganeti emulates USB 1.0 (UHCI) controller. USB 2.0 devices don't work with it.
That's where the questiion "is it possible to passthrough USB 2.0 devices with ganeti" arose.
As we could see we can do it with KVM itself.

Roman Vrublevskiy

unread,
May 22, 2015, 7:53:32 AM5/22/15
to gan...@googlegroups.com
I managed to do that.

We need to use kvm_extra parameters. It works with the following:
gnt-instance modify -H kvm_extra="-device usb-ehci\,id=ehci\,bus=pci.0\,addr=0x10 -device usb-host\,vendorid=0x8564\,productid=0x1000\,bus=ehci.0" bcalfa

Without bus=pci.0,addr=0x10 I got an errors such as this:
gnt-instance start bcalfa
Waiting for job 155917 for bcalfa ...
Job 155917 for bcalfa has failed: Failure: command execution error:
Could not start instance 'bcalfa': Hypervisor error: Failed to start instance bcalfa: exited with exit code 1 (qemu-system-x86_64: -device virtio-blk-pci,drive=hotdisk-4897a639-pci-4,id=hotdisk-4897a639-pci-4,bus=pci.0,addr=0x4: PCI: slot 4 function 0 not available for virtio-blk-pci, in use by usb-ehci
qemu-system-x86_64: -device virtio-blk-pci,drive=hotdisk-4897a639-pci-4,id=hotdisk-4897a639-pci-4,bus=pci.0,addr=0x4: Device initialization failed.
qemu-system-x86_64: -device virtio-blk-pci,drive=hotdisk-4897a639-pci-4,id=hotdisk-4897a639-pci-4,bus=pci.0,addr=0x4: Device 'virtio-blk-pci' could not be initialized
)
Reply all
Reply to author
Forward
0 new messages