[virt-tools-list] [PATCH 0/2] add USB redirection support in virt-manager

Hans de Goede hdegoede at redhat.com
Mon Jun 24 17:52:38 UTC 2013


Hi,

On 06/24/2013 12:11 PM, Guannan Ren wrote:
>
> This two patch use spicy-client python binding to add USB redirection
> support in virt-manager if guests use spice viewer.

Very cool, thanks for working on this. I've done a quick review, mostly
from the usbredir pov rather then a code pov, and there is one thing
missing.

Now that virt-manager will have a usb-device selection dialog, it
should probably also enable usb autoredirection by setting the
auto-connect property of the UsbDeviceManager to true, this will enable
the "If the virt-viewer window has the current focus and I insert a USB
device, it will be automatically redirected to the guest" behavior
Leonardo is talking about.

I see that Cole is not necessarily a fan of it. Cole, you should give
this a try, most users love it. In virt-viewer we just always enable
it without any complaints. Alternatively it could be made an option
but I would default it to true.

> Add "Select USB devices to redirect" option in console viewer
> Initialize and embed UsbDeviceWidget object from SpiceClientGtk into
> a dialog to let user choose available USB devices for redirection.
> Throw an error message if USB connection failed.
>
> These feature works well if running virt-manager application with
> super root privilege. But if running it with non-root user, libusb
> will report Permission problem as follows.
>
> libusbx: error [op_open] libusbx couldn't open USB device /dev/bus/usb/002/010: Permission denied.
> libusbx: error [op_open] libusbx requires write access to USB device nodes.
>
> I am not sure about this, the error explains itself. In this case virt-manager
> will popup a dialog to show related error from spice-client library.

That should not happen, spice-gtk will invoke
/usr/libexec/spice-gtk-x86_64/spice-client-glib-usb-acl-helper

Which is a suid root binary, that will call into pollkit to ask if it is ok to
change rights on the device node, and then change the rights on the device node
(the default polkit policy is allow local).

If this is not working for you something is wrong with your spice-gtk installation,
for starters check the helper binary is properly suid-root.

And if you compiled from source, re-run ./configure and ensure that nothing
is missing.

Regards,

Hans




More information about the virt-tools-list mailing list