WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

[Xen-users] Solved, but rather a crutch (Was: Passing USB device to MS W

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] Solved, but rather a crutch (Was: Passing USB device to MS Windows guest)
From: Willy Weisz <weisz@xxxxxxxxxxxxxxxxx>
Date: Mon, 02 Mar 2009 00:56:09 +0100
Cc: groen692@xxxxxxxxx
Delivery-date: Sun, 01 Mar 2009 15:57:14 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <49958B22.8060906@xxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Organization: VCPC, European Centre for Parallel Computing at Vienna
References: <49958B22.8060906@xxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.18) Gecko/20081031 SeaMonkey/1.1.13
I've found the causes of my problems and have created a fix (but not a real solution) for it.

The first step (which is a real solution):
'qemu-dm' uses the out-fashioned (pre-kernel 2.6) /proc file system to access system information (more precisely the sub-directory /proc/bus/usb) and not the usbfs file system. The file /etc/fstab hass an entry for the mount point /proc/bus/usb that hooks the usbfs up there, but this is not done at boot time since it is prevented by the option 'noauto' in said entry. The command 'mount /proc/bus/usb' must be entered manually or put in a file in /etc/init.d/.

This first step allows qemu the access to the USB devices.

The second step should be to correct a conceptual bug in the handling of 'usbdevice' in the Python routines called by the commands 'xend' as well as 'xm': 'usbdevice' is considered to be part of the platform definition instead of being handled as a device entry. As part of the platform definition it only accepts a single instantiation with a single value (in my case only 'tablet' or 'host:Id1:Id2'), handled as a device, it could be instantiated multiple times with different values.

Lacking a good documentation on the information flow through the Python routines and the time to make a complete analysis of what parts of the code to patch (at least the routines xend/image.py, xm/main.py, xm/create.py and xm/xenapi_create.py), I decided to find a solution for my problem only: In order to be able to start a VM with multiple USB devices I extended the 'usbdevice' option of the command 'xm create' to accept a character string with a comma-separated list of USB devices (e.g. usbdevice='tablet, host:05e3:0100' with white-spaces allowed before and after any list entry) which translates to multiple 'usbdevice' options for the 'qemu-dm' command. The necessary patch for the routine xend/image.py is attached.

This patch isn't meant to be the solution, but rather a crutch solid enough for my actual needs. I hope that XEN developers will work on a real solution that will include the possibility to include multiple 'usbdevice' definitions in the configuration files for the VMs, moving 'usbdevice' from a platform entry to a device entry and defining a syntax for the configuration file entries.

As for the unavailable entry 'usb_add' in the qemu-dm monitor it is the result of a 'censorship' measure by the authors of the openSuSE rpm package 'xen-tools'. As a consequence of the vulnerability CVE-2007-0998 reported by RedHat they deleted a few monitor commands thought to endanger the confidentiality of some Dom0 informations - neither Mitre nor NIST have yet fully assessed the 'danger' despite the fact that the initial report dates from more than 2 years ago. The problem is not so much the patch itself (it can easily be removed by commenting out the corresponding patch in the xen.spec file of the source rpm or setting the variable CONFIG_TRUSTED_CLIENT, and rebuilding the package), but simply the fact that there is no mention of it anywhere in the doc files accompanying the rpm package nor on the openSuSE web site. The search for the reason for the 'missing monitor commands' has cost a lot of the delay in finding a solution. Nevertheless the 'amputed' qemu monitor is well suited for use with my patch.

I hope this lengthy mail helps some XEN users, and kicks off the development of a real solution for the USB configuration of fully virtualised VMs.

Regards
Willy

Willy Weisz wrote:
The configuration:

Dom0: openSuse 11.1 xen kernel for x86_64 and Xen 3.3.1
DomU: MS Windows XP

I want to pass a USB device with the identification 05e3:0100 to the DomU

First attempt:
I added a line
usbdevice="host:05e3:0100"
to the configuration file for the DomU already existing in /etc/vm. The file also contains the lines
usb=1
usbdevice="tablet"
.

After rebooting the VM in DomU no USB device other than the "tablet" (mouse equivalent) is available. A look at the log files of the Dom0 reveals no mention of "host:05e3:0100".

Second attempt:
On the graphical console (vnc) of the VM running Windows I switched to the qemu monitor (version 0.9.1) with Alt+Crl+2 and entered the command "usb_add", and qemu answered: "unknown command: 'usb_add'; by the way, "help" doesn't list "usb_add" either.

So both approaches described in the Xen 3.3 User's Guide and in some other places on the web don't work.

Since the only reason for running Windows is using a software package that isn't available for Linux and that uses the USB device as input device, I'm stuck and need urgently help.

Regards
Willy

--
-----------------------------------------------------------
Willy Weisz

European Centre for Parallel Computing at Vienna (VCPC)
         Institute of Scientific Computing
              University of Vienna
                Nordbergstrasse 15/C312
                A-1090 Wien
Tel: (+43 1) 4277 - 39424          Fax: (+43 1) 4277 - 9394
               e-mail: weisz@xxxxxxxxxxxxxxxxx

--- xend/image.py.orig  2009-02-26 23:17:51.000000000 +0100
+++ xend/image.py       2009-03-02 00:11:16.000000000 +0100
@@ -742,6 +742,12 @@
                     if v: ret.append("-%s" % a)
                 except (ValueError, TypeError):
                     pass # if we can't convert it to a sane type, ignore it
+            # Handle usbdevice so that it passes multiple devices
+            if a == 'usbdevice':
+                d = v.split(',')
+                for u in d:
+                    ret.append("-%s" % a)
+                    ret.append("%s" % u.strip())
             else:
                 if v:
                     ret.append("-%s" % a)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>