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

Daniel Veillard veillard at redhat.com
Thu Mar 8 14:27:04 UTC 2007


On Thu, Mar 08, 2007 at 12:59:30PM +0000, Daniel P. Berrange wrote:
> 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'
> 
> http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC34
> 
> 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/>
>     <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 ?

  That I prefer we first discuss a bit more the format before applying such a
patch. I assume the usb description need to go in the <devices> block, right ?
I prefer the last version of the 3, you just check for a first attribute
and if found derive the processing code according to the value. It's IMHO
better than the second structurally speaking, and I really dislike the first
because it keeps the structure outside of XML which requires additional 
parsing and makes things harder.
  Now thinking out loud a bit, would <usb> need to be a structure, physically
it is structured around busses, do we need to reflect that, do we need
to make provision for this. Also in what respect is USB specific, I mean
  <devices>
    <disk path="..." />
  </devices>
and 
  <devices>
    <usb>
      <disk path="..." />
    </usb>
  </devices>

Can we just share parsing or is the fact that a disk hooked on USB bus such
a real difference ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list