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'>
<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
[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 (19):
conf: Add definitions for "vhost" protocol in hostdev tags
util: Allow a vhost protocol for scsi hostdev
security: Allow a vhost protocol for scsi hostdev
qemu: Refactor qemuIsSharedHostdev for readability/extendability
qemu: Allow a vhost protocol for scsi hostdev
conf: Parse vhost-scsi XML tag
conf: Prevent use of shareable on vhost-scsi devices
qemu: Introduce vhost-scsi capability
qemu: Refactor qemuBuildHostdevCommandLine for non-vhost devices
qemu: Add vhost-scsi string for -device parameter
qemu: Add vhost-scsi to hostdev schema
docs: Add vhost-scsi to documentation
qemu: Refactor hotplug in preparation for vhost-scsi
qemu: Allow hotplug of vhost-scsi device
conf: Create vhost-scsi hostdev protocol in dumpxml
conf: Set up vhost-scsi hostdev to self-close source tag
tests: Introduce basic vhost-scsi test
conf: Do not create a virtio-scsi controller for vhost-scsi hostdev
qemu: Allow the specification of a vhost-scsi devno
docs/formatdomain.html.in | 16 +++
docs/schemas/domaincommon.rng | 12 +++
src/conf/domain_conf.c | 94 ++++++++++++++--
src/conf/domain_conf.h | 8 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_cgroup.c | 5 +
src/qemu/qemu_command.c | 120 +++++++++++++++++++--
src/qemu/qemu_command.h | 6 ++
src/qemu/qemu_conf.c | 21 +++-
src/qemu/qemu_domain_address.c | 10 ++
src/qemu/qemu_hotplug.c | 76 +++++++++----
src/qemu/qemu_monitor.c | 21 ++++
src/qemu/qemu_monitor.h | 4 +
src/security/security_apparmor.c | 5 +-
src/security/security_dac.c | 10 +-
src/security/security_selinux.c | 10 +-
src/util/virhostdev.c | 13 ++-
src/util/virscsi.c | 26 +++++
src/util/virscsi.h | 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 +
.../qemuxml2argv-hostdev-scsi-vhost-scsi.args | 24 +++++
.../qemuxml2argv-hostdev-scsi-vhost-scsi.xml | 33 ++++++
tests/qemuxml2argvmock.c | 12 +++
tests/qemuxml2argvtest.c | 3 +
35 files changed, 486 insertions(+), 58 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