[Libvir] [PATCH] Enable USB device setting information handling on virsh.

Daniel P. Berrange berrange at redhat.com
Thu Mar 8 12:59:30 UTC 2007

On Thu, Mar 08, 2007 at 04:52:43PM +0900, Masayuki Sunou wrote:
> Hi
> When domHVM started by virsh create, 
> the information of USB setting is not saved by vish dumpxml.
> The reason is that USB setting is defined by Xen itself, not virsh.
> This patch enables USB device setting information handling 
> on virsh create/virsh dumpxml.

I've been wondering about how we'll represent USB devices in the
libvirt XML. The 'usbdevice' attribute in teh XenD SEXPR is just
a straight pass-through to QEMU's -usbdevice command line arg.
This arg can accept values of the form:

  - 'mouse'
  - 'tablet'
  - 'disk:file'    eg 'disk:/var/lib/xen/images/usbdrive.img'
  - 'host:bus.addr'  eg 'host:01.02'  for BUS 01, device 02
  - 'host:vendor:product'   eg 'host:0324:01a4'


The patch you've got just puts all this into a single 'usbdevice'
attribute on a <usb> element. I see there is also a single empty
<usb> tag to identify whether the virtual USB bus is enabled at
all. So we have

    <usb usbdevice='mouse'/>
    <usb usbdevice='tablet/>
    <usb usbdevice='disk:/var/lib/xen/images/usbdrive.img'/>
    <usb usbdevice='host:01.02'/>
    <usb usbdevice='host:0324:01a4'/>

I'm wondering if we'd be better offnormalizing the attributes somewhat.

   <usb bus='1'/>
   <usb hid='mouse'/>   (hid is USB speak for Human Input Device)
   <usb hid='tablet'/>
   <usb disk='/var/lib/xen/images/usbdrive.img'/>
   <usb bus='01' addr='02'/>
   <usb vendor='0324' product='01a4'/>

Or alternatively, multiplex off a 'type' attribute

   <usb type='bus'/>
   <usb type='mouse'/>
   <usb type='tablet'/>
   <usb type='disk' path='/var/lib/xen/images/usbdrive.img'/>
   <usb type='host' bus='01' addr='02'/>
   <usb type='host' vendor='0324' product='01a4'>

What do people think ?

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the libvir-list mailing list