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

Guido Günther agx at sigxcpu.org
Thu Jul 31 08:17:39 UTC 2008


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'> 
then?
 -- Guido




More information about the libvir-list mailing list