[libvirt] [PATCH/RFC]: file backed usb massstorage

Daniel P. Berrange berrange at redhat.com
Thu Jul 31 08:39:44 UTC 2008


On Thu, Jul 31, 2008 at 04:17:39AM -0400, Guido G?nther wrote:
> On Wed, Jul 30, 2008 at 09:47:00AM +0100, Daniel P. Berrange wrote:
> > On Mon, Jul 28, 2008 at 11:02:45AM -0400, Guido G?nther wrote:
> > > On Fri, Jul 25, 2008 at 04:17:30PM -0400, Guido Günther wrote:
> > > > attached is some basic support for host device passthrough. It enables
> > > > you to passthrough usb devices in qemu/kvm via:
> > > On top of the hostdev passthrough (but it's actually totally
> > > independent) I added usb massstorage backed by a file. Very handy for
> > > installer testing where the preseed data is on the USB stick and the
> > > CD/DVD is the installation medium.
> > > At the moment I'm using a dummy target "usbdisk" so we don't have to
> > > check for target == NULL in that many places. Once qemu handles it we
> > > can fill in bus and device address for unplugging. To add a file as usb
> > > massstorage to the guest you can use:
> > > 
> > > <disk type='file' device='disk'>
> > >      <source file='/foo/bar/usbmass.img'/>
> > >      <target bus='usb'/>
> > > </disk>
> > 
> > The way we do target for other disk types doesn't work so well - others
> > we typically have a device name, eg hda, sdc, xvdf, etc. For VirtIO we
> > let people pass in a dummy device name too 'vda', 'vdb', etc. Only some
> > of the disk buses & guest OS honour these names though - in cases where
> > they're not honoured, they at most provide a unique key, and allow for
> > ordering of disks in our XML. USB will be much like SCSI / VirtIO where
> > the device name in the XML is merely used for ordering, so we should just
> > allow  sda, sdb, etc as the target device name. This will avoid having
> > to special case the code in the here too much.
> Acutally I intended to use the target like target="bus:device" once qemu
> (and others) support this. The would also help on detach. Would you
> prefer: 
> <target bus='usb' target='sda' bus='0001' id='1234'> 

Taking into account the other thread discussing USB/PCI device passthrough
to the guest for host device, I think it'd be worth having an explicit
'address' element for the USB details using a matching syntax, eg

  <target dev='sda' bus='usb'>
    <address bus='0001' dev='1234'/>
  </target>

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list