[libvirt] [PATCH 1/2] qemu: add vhost-scsi-pci definitions

Nicholas A. Bellinger nab at linux-iscsi.org
Fri Jul 25 21:58:58 UTC 2014


(Resending, as the last email did not make it to the list)

On Fri, 2014-07-25 at 09:53 +0100, Daniel P. Berrange wrote:
> On Thu, Jul 24, 2014 at 11:18:14PM -0700, Nicholas A. Bellinger wrote:
> > On Thu, 2014-07-24 at 10:53 +0100, Daniel P. Berrange wrote:
> > > On Thu, Jul 24, 2014 at 08:25:59AM +0200, Paolo Bonzini wrote:
> > > > Il 24/07/2014 05:24, Nicholas A. Bellinger ha scritto:
> > > > > From: Mike Perez <thingee at gmail.com>
> > > > > 
> > > > > This patch adds the necessary definitions to support vhost-scsi-pci and
> > > > > VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI in QEMU >= v1.5.x code.
> > > > > 
> > > > > This includes:
> > > > > 
> > > > >   - Add QEMU_CAPS_VHOST_SCSI
> > > > >   - Add virDomainControllerDef->wwpn pointer for the vhost-scsi wwpn.
> > > > >   - Setting the new model type in qemuSetSCSIControllerModel()
> > > > >   - Invoking virDomainPCIAddressReserveAddr() for vhost-scsi-pci in
> > > > >     qemuAssignDevicePCISlots()
> > > > >   - Add the 'wwpn=' device parameter in qemuBuildControllerDevStr()
> > > > >   - Add vhost-scsi-pci to >= v1.5.x qemucapabilitiesdata
> > > > >   - Add xml2argv and xml2xml tests for cmd_per_lun + max_sectors +
> > > > >     num_queues + wwpn.
> > > > > 
> > > > > Signed-off-by: Mike Perez <thingee at gmail.com>
> > > > > Signed-off-by: Nicholas Bellinger <nab at linux-iscsi.org>
> > > > 
> > > > Configuration still has to go through configfs; I'm not sure how using <disk>
> > > > and vhost-scsi together makes sense:
> > > > 
> > > > +    <disk type='block' device='disk'>
> > > > +      <source dev='/dev/HostVG/QEMUGuest1'/>
> > > > +      <target dev='sdb' bus='scsi'/>
> > > > +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> > > > +    </disk>
> > > > +    <controller type='usb' index='0'/>
> > > > +    <controller type='scsi' index='0' model='vhost-scsi'>
> > > > +      <driver wwpn='naa.60014050a13df4f2'/>
> > > > +    </controller>
> > > > 
> > > > ...
> > > > 
> > > > +-device vhost-scsi-pci,id=scsi0,wwpn=naa.60014050a13df4f2 \
> > > > +-usb \
> > > > +-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
> > > > +-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
> > > > +drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
> > > > 
> > > > and I'm not sure even how it can work since vhost-scsi-pci doesn't expose
> > > > a QEMU SCSI bus.
> > > 
> > > Indeed, it doesn't seem to actually work. I have a vm where I'm
> > > using virtio-scsi, so I changed the model to vhost-scsi and added
> > > a random wwpn string (unclear if there's any rules for generating
> > > these wwpn strings?).
> > > 
> > >     <disk type='file' device='disk'>
> > >       <driver name='qemu' type='raw'/>
> > >       <source file='/var/lib/libvirt/images/data1.img'/>
> > >       <target dev='sda' bus='scsi'/>
> > >       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> > >     </disk>
> > >     <disk type='file' device='disk'>
> > >       <driver name='qemu' type='raw'/>
> > >       <source file='/var/lib/libvirt/images/data2.img'/>
> > >       <target dev='sda' bus='scsi'/>
> > >       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
> > >     </disk>
> > >     <disk type='file' device='disk'>
> > >       <driver name='qemu' type='raw'/>
> > >       <source file='/var/lib/libvirt/images/data3.img'/>
> > >       <target dev='sda' bus='scsi'/>
> > >       <address type='drive' controller='0' bus='0' target='0' unit='2'/>
> > >     </disk>
> > >     <controller type='scsi' index='0' model='vhost-scsi'>
> > >       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
> > >       <driver wwpn='naa.60014050a13df4f2'/>
> > >     </controller>
> > > 
> > > When I try to start the guest it fails to find the SCSI controller
> > > 
> > >   qemu-system-x86_64: -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,\
> > >   lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0: Bus 'scsi0.0' not found
> > > 
> > 
> > Thanks for the comments.
> > 
> > Dropping the disk virtio-scsi disk sections now.
> 
> Huh ? If you don't have the virtio-scsi disk args how are you supposed
> to attach the disks to the VM.
> 

A vhost-scsi controller instance doesn't require the extra virtio-scsi
disk args, at least not in order to boot QEMU proper.

The configuration of vhost-scsi WWPNs and their associated LUNs is done
using a configfs based control plane provided by the in-kernel target,
for which all in-kernel drivers share common code within
drivers/target/target_core_fabric_configfs.c.

Configfs provides reference counting for data structures within
vhost-scsi itself, and also inter-module reference counting between LIO
backend devices under /sys/kernel/config/target/core/$HBA/$DEV/, and
vhost-scsi LUN export.

The virtio-scsi LLD Host:Channel:Target:LUN disk locations in the guest
are based upon what is populated using configfs groups + symlinks
under /sys/kernel/config/target/vhost/$WWPN/$TPGT/lun/$LUN.

The rtslib library + targetcli shell are the preferred (and friendliest)
way for driving the creation of vhost-scsi controllers + LUN exports.

Thanks,

--nab




More information about the libvir-list mailing list