[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Need help trying to use SPICE USB Redirection on Xen 4.5



Il 25/04/2015 21:32, Zir Blazer ha scritto:
At the moment, I have a Windows DomU and an Arch Linux DomU (Which I can use 
standalone or with Nested Xen, depending on what I want to test). A thing which 
is extremely clumsy to do is using USB Devices, since by default you can't use 
them directly in the VMs. I usually don't notice the lack of that because the 
only thing I use are Pendrives, which I can mount on Dom0 along with my Windows 
DomU Shared Folder, then from within Dom0, move or copy files from the Pendrive 
to the Shared Folder, and finally, from inside the DomU, move from the Shared 
Folder to the final archiving location (Or viceversa). As you see, it is a 
complex and tedious procedure for something that on native is rather simple, 
but it works for managing files. However, today I wanted to use Windows-based 
tools to make a booteable USB Pendrive, and found that I need to reconsider my 
current approach with USB since I need to access it directly, I can't 
workaround this like I did previously.
At first, I was considering doing PCI Passthrough of the USB Controller that 
controls the Ports of the front panel of the case, since those are the ones I 
use for temporal devices. However, since 4.4, Xen supports SPICE, and one of 
its features its the supposedly amazing USB Redirection. In Arch Linux, the xen 
package maintainer has SPICE and USB Redirection already included, so the 
Software side seems to be ready to go.

Current documentation includes the Xen Wiki and xl docs that tells you with 
what parameters you enable SPICE:

http://wiki.xen.org/wiki/SPICE_support_in_Xen
http://xenbits.xen.org/docs/4.4-testing/man/xl.cfg.5.html#spice_graphics_support

...but I failed to find instructions about what to do after that.



I didn't tested on my Windows DomU, but I'l give details of what I did with my 
Arch Linux DomU config file. I added the following lines:

spice = 1
spiceport = 6000
spicedisable_ticketing = 1

This is the bare minimum that I need to make xl create work with SPICE, since 
xl create gives errors if I don't specify a port and a password (Or using the 
third line to disable it). The first thing which I'm not sure about, is if 
SPICE is remotely accessible from other machines of the Network or Dom0 itself 
just by being enabled. The reason is that SPICE seems to be remote-oriented and 
a VNC replacement, but I do not use VNC, just sdl = 1, so I get a local window 
for the DomU, and no remote connections support provided by Xen itself, so 
never really cared about listening Ports, passwords and security. So, I don't 
understand if SPICE forces me to have that Port listening, or I can deal with 
it like with SDL.
Regardless if I have the previous three lines or not, the next step is checking 
lsusb on the Arch Linux DomU. Initially, it always returned this error:

unable to initialize libusb: -99

After some googling, the cause for that error is because there are no USB 
Controllers, which is rather common on VMs. Obviously, the lspci output is 
quite basic.:

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
00:03.0 VGA compatible controller: Device 1234:1111
00:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. 
RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 20)

...however, when I add...

spiceusbredirection = 1

...The DomU lspci list grow with these:

00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI 
Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI 
Controller #1 (rev 03)

...and lsusb also works...

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

There is no difference in lspci and lsusb output regarding using 
spiceusbredirection = 1 or 4 (Which is the max).

So I suppose that from the Xen side, USB Redirection is properly working, and I 
can get it enabled in the DomU, since adding an USB Controller is the 
documented behavior.
Point is, after enabling SPICE and USB Redirection in the DomU config file, how 
I am supposed to tell Dom0 that it should redirect a specific port to a 
specific DomU? I can't find instructions about how to do that in Xen. Can I do 
it with commands or a config file, or I need to install SPICE-specific tools?   
                                 

Spice usb redirection is for redirect usb devices from spice client to domU's with spice connected, both must support it. Based on spice client is possible to specify what redirect or redirect all usb device automatically, best spice client software to use is virt-viewer.

On domU's xl cfg you must add:
spiceusbredirection=4
Will automatically add qemu emulated usb 2 controller and 4 usb redirection channels (1 channel for each usb device to redirect).

No special drivers is needed, any usb devices you'll redirect will be see by domU's S.O. same as phisical pc, working and tested on both linux and windows, tested standard/special usb mass drive, smartcard reader, dvd writer, scanner, printers, webcam, headphones ecc...


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.