On 10/26/2016 05:42 PM, Eric Farman wrote:
[Author note: Apologies for an extra release or two in between
versions,
I was sidetracked by another project. This is probably too close to the
impending freeze for 2.4, so I just updated doc to 2.5 in anticipation.
In rearranging the patches, I've inserted a cleanup patch at the head
that was mentioned in the v2 review, and which could go separately.]
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].
This series doesn't seem to apply on current git HEAD (commit id '
011935457') starting with patch 2:
error: patch failed: src/conf/domain_conf.c:12997
error: src/conf/domain_conf.c: patch does not apply
error: patch failed: src/qemu/qemu_cgroup.c:376
error: src/qemu/qemu_cgroup.c: patch does not apply
error: patch failed: src/security/security_apparmor.c:909
error: src/security/security_apparmor.c: patch does not apply
error: patch failed: src/security/security_selinux.c:1498
error: src/security/security_selinux.c: patch does not apply
In particular, if you look closer at those sections they all seem to
have switch statements for VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_*: that don't
exist on master.
So is something missing? It feels like there's a patch missing with the
conversion of "default:" to LAST labels.
Maybe you picked up something that wasn't pushed? Not quite sure.
John
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:
v2.1->v3:
- Rebase
- Rebased to current master (26 October)
- Comments
- Added an early patch to do some additional typecasting in the
switch statements of hostdev.subsys.type
- Did some reordering of patches, to hopefully flow better
- Implemented an activeHostHostdevs list, which is used by the
cgroup and security codepaths
- doc changes -- s/2.2/2.5/ and s/HBI/HBA/
- Added a "none" protocol type for scsi_host hostdevs (which is invalid)
- Restored the apparmor and selinux codepaths that got lost from v1
- Added a proper check for a valid scsi_host protocol, and saving that
value within the HostdevDef struct
- Fixed a compiler warning with call to virDomainPCIAddressEnsureAddr
- Removed the rest of vhostfdSize, since multiple fd's are not allowed
by QEMU
- Fixed cleanup of vhostfd in error from building -device string
- Moved the "conf" chunk from "hotplug" patch to
"introduce" patch
- Added xml2xml test
- Added a proper calculation of "address" in virDomainAuditHostdev
- Added a virFileExists check before open(/dev/vhost-scsi)
- Addressed a number of lines >80 characters
- Things *NOT* done (later?)
- Investigation/tie-in with virsh nodedev-list stuff
- Implementation of 'num_queues', 'max_sectors', and
'cmd_per_lun'
(Need to research these in the virtio space, before figuring out
how to apply to vhost-scsi)
- Dropping the "naa." prefix of wwn
- Split the "tests" patch into earlier patches
- Other
v2.1:
https://www.redhat.com/archives/libvir-list/2016-September/msg00148.html
v2:
https://www.redhat.com/archives/libvir-list/2016-August/msg01028.html
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 (9):
qemu: Introduce vhost-scsi capability
Introduce a "scsi_host" hostdev type
util: Management routines for scsi_host devices
qemu: Add vhost-scsi string for -device parameter
qemu: Allow hotplug of vhost-scsi device
conf: Wire up the vhost-scsi connection from/to XML
security: Include vhost-scsi in security labels
tests: Introduce basic vhost-scsi test
docs: Add vhost-scsi
docs/formatdomain.html.in | 24 ++
docs/schemas/domaincommon.rng | 23 ++
src/Makefile.am | 1 +
src/conf/domain_audit.c | 7 +
src/conf/domain_conf.c | 91 ++++++-
src/conf/domain_conf.h | 18 ++
src/libvirt_private.syms | 19 ++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_cgroup.c | 39 +++
src/qemu/qemu_command.c | 79 ++++++
src/qemu/qemu_command.h | 5 +
src/qemu/qemu_domain_address.c | 10 +
src/qemu/qemu_hostdev.c | 41 +++
src/qemu/qemu_hostdev.h | 8 +
src/qemu/qemu_hotplug.c | 160 +++++++++++
src/security/security_apparmor.c | 20 ++
src/security/security_dac.c | 46 ++++
src/security/security_selinux.c | 43 +++
src/util/virhost.c | 301 +++++++++++++++++++++
src/util/virhost.h | 72 +++++
src/util/virhostdev.c | 155 +++++++++++
src/util/virhostdev.h | 16 ++
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 | 41 +++
tests/qemuxml2argvmock.c | 9 +
tests/qemuxml2argvtest.c | 3 +
.../qemuxml2xmlout-hostdev-scsi-vhost-scsi.xml | 1 +
tests/qemuxml2xmltest.c | 3 +
41 files changed, 1272 insertions(+), 2 deletions(-)
create mode 100644 src/util/virhost.c
create mode 100644 src/util/virhost.h
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi.xml
create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scsi.xml