This patch series provides a libvirt implementation of the vhost-scsi
interface in QEMU.  As near as I can see, this was discussed upstream in
July 2014[1], and ended in a desire to replace a vhost-scsi controller
in favor of a hostdev element instead[2].

There is no capability check in this series for vhost-scsi in the underlying
QEMU.  Using a recent QEMU built with --disable-vhost-scsi fails with "not a
valid device model name."

Host Filesystem Example:
  # ls /sys/kernel/config/target/vhost/
  discovery_auth  naa.5001405df3e54061  version
  # ls /sys/kernel/config/target/vhost/naa.5001405df3e54061/tpgt_1/lun/
  lun_0

QEMU Example (snippet):
  -device vhost-scsi-ccw,wwpn=naa.5001405df3e54061,devno=fe.0.1000

Libvirt Example (snippet):
  <hostdev mode='subsystem' type='scsi_host'>
    <source protocol='vhost' wwpn='naa.5001405df3e54061'/>
    <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x1000'/>
  </hostdev>

Guest Viewpoint:
  # lsscsi
  [1:0:1:0]    disk    LIO-ORG  disk0            4.0   /dev/sda 
  # dmesg | grep 1:
  [    6.065735] scsi host1: Virtio SCSI HBA
  [    6.093892] scsi 1:0:1:0: Direct-Access     LIO-ORG  disk0            4.0  
PQ: 0 ANSI: 5
  [    6.313615] sd 1:0:1:0: Attached scsi generic sg0 type 0
  [    6.314981] sd 1:0:1:0: [sda] 29360128 512-byte logical blocks: (15.0 
GB/14.0 GiB)
  [    6.317290] sd 1:0:1:0: [sda] Write Protect is off
  [    6.317566] sd 1:0:1:0: [sda] Mode Sense: 43 00 10 08
  [    6.317853] sd 1:0:1:0: [sda] Write cache: enabled, read cache: enabled, 
supports DPO and FUA
  [    6.352722] sd 1:0:1:0: [sda] Attached SCSI disk

Changelog:
  v1->v2:
   - Rebase
     - Applies to current master (20 August)
     - Added a capability check for QEMU 2.7
     - Fixed the qemuxml2argv tests as the -smp options had changed
     - Reworked ccwaddrs parameter in virDomainCCWAddressAssign call
   - Comments
     - Squashed documentation, XML schema, XML parsing, and infrastructure
       patches into a single patch
     - Switched from "hostdev type='scsi'" to "hostdev type='scsi_host'";
       this removes the refactoring patches since we're not shoe-horning
       a new SCSI protocol into the existing code
     - Reworked the handling of the fd's such that we send them to qemu
       after any possible errors could occur and cause us to back out
     - s/qemuBuildSCSIVhostHostdevDevStr/qemuBuildHostHostdevDevStr/
     - Added virBufferCheckError, and an error message for vhostfdSize > 1,
       in qemuBuildHostHostdevDevStr
     - Added qemuBuildDeviceAddressStr in qemuBuildHostHostdevDevStr, thus
       superceding the last patch in the v1 series
   - Other
     - Simplified the vhostfd logic to just be a single int, rather than
       an alloc'd array (left the vhostfdSize described above as an
       identifier for if QEMU ever supports multiple vhostfds)
     - Replaced "qemuMonitorAddDevice" with "qemuMonitorAddDeviceWithFd"
       in hotplug routine

  v1:  https://www.redhat.com/archives/libvir-list/2016-July/msg01004.html

[1] http://www.redhat.com/archives/libvir-list/2014-July/msg01235.html
[2] http://www.redhat.com/archives/libvir-list/2014-July/msg01390.html

Eric Farman (5):
  Introduce a "scsi_host" hostdev type
  qemu: Introduce vhost-scsi capability
  qemu: Add vhost-scsi string for -device parameter
  qemu: Allow hotplug of vhost-scsi device
  tests: Introduce basic vhost-scsi test

 docs/formatdomain.html.in                          |  24 ++++
 docs/schemas/domaincommon.rng                      |  23 ++++
 src/conf/domain_audit.c                            |   2 +
 src/conf/domain_conf.c                             |  62 ++++++++-
 src/conf/domain_conf.h                             |  17 +++
 src/libvirt_private.syms                           |   1 +
 src/qemu/qemu_capabilities.c                       |   2 +
 src/qemu/qemu_capabilities.h                       |   1 +
 src/qemu/qemu_command.c                            |  80 +++++++++++
 src/qemu/qemu_command.h                            |   6 +
 src/qemu/qemu_domain_address.c                     |  10 ++
 src/qemu/qemu_hotplug.c                            | 149 +++++++++++++++++++++
 src/security/security_dac.c                        |   2 +
 src/util/virscsi.c                                 |  26 ++++
 src/util/virscsi.h                                 |   1 +
 tests/domaincapsschemadata/full.xml                |   1 +
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |   1 +
 .../caps_2.6.0-gicv2.aarch64.xml                   |   1 +
 .../caps_2.6.0-gicv3.aarch64.xml                   |   1 +
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml  |   1 +
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |   1 +
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |   1 +
 .../qemuxml2argv-hostdev-scsi-vhost-scsi.args      |  24 ++++
 .../qemuxml2argv-hostdev-scsi-vhost-scsi.xml       |  33 +++++
 tests/qemuxml2argvmock.c                           |  12 ++
 tests/qemuxml2argvtest.c                           |   3 +
 31 files changed, 488 insertions(+), 2 deletions(-)
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.args
 create mode 100644 
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.xml

-- 
1.9.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to