v2 of:
https://www.redhat.com/archives/libvir-list/2018-January/msg00584.html
diff to v1:
- Dropped the hash table and stayed with simple pid_t in vm->privateData
- Couple of small fixes (basically to address Peter's review)
What is still missing:
- Event from qemu when the helper process dies (in my testing, qemu
process dies as soon as it tries to do PR).
- <hostdev/> support, which surprisingly works even without these
patches. I mean, if I add the following hostdev the guest is already
able to do PR even with plain origin/master:
<hostdev mode='subsystem' type='scsi' managed='no'
rawio='no'>
<source>
<adapter name='scsi_host7'/>
<address bus='0' target='0' unit='0'/>
</source>
<address type='drive' controller='0' bus='0'
target='0' unit='4'/>
</hostdev>
where host7 is an iSCSI device:
/sys/bus/scsi/devices/7\:0\:0\:0/block/sdd/
and the part of generated cmd line:
-drive file=/dev/sg3,if=none,id=drive-hostdev0 \
-device
scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=4,drive=drive-hostdev0,id=hostdev0
However, the qemu is running under my regular user nor it has any
special capabilities:
# grep -e "^Name" -e "^Uid" -e "^Gid" -e "^Cap"
/proc/$(pgrep qemu)/status
Name: qemu-system-x86
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
As usual, you can find the patches on my github too:
https://github.com/zippy2/libvirt/tree/pr_v2
Michal Privoznik (12):
virstoragefile: Introduce virStoragePRDef
qemuDomainDiskChangeSupported: Deny changing reservations
qemu: Introduce pr-manager-helper capability
qemu: Generate alias and socket path for pr-helper
qemu: Store pr runtime data in status XML
qemu: Generate cmd line at startup
qemu: Introduce pr_helper to qemu.conf
qemu_domain: Track pr-helper PID in status XML
qemu: Start PR daemons on domain startup
qemu_hotplug: Hotplug of reservations
qemu_hotplug: Hotunplug of reservations
qemu: Detect pr-manager-helper capability
docs/formatdomain.html.in | 25 ++-
docs/schemas/domaincommon.rng | 34 +---
docs/schemas/storagecommon.rng | 50 +++++
m4/virt-driver-qemu.m4 | 5 +
src/conf/domain_conf.c | 36 ++++
src/libvirt_private.syms | 6 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 4 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 40 ++++
src/qemu/qemu_conf.c | 7 +-
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 213 ++++++++++++++++++++-
src/qemu/qemu_domain.h | 15 ++
src/qemu/qemu_hotplug.c | 94 +++++++++
src/qemu/qemu_process.c | 188 ++++++++++++++++++
src/qemu/qemu_process.h | 7 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/virstoragefile.c | 181 +++++++++++++++++
src/util/virstoragefile.h | 19 ++
.../disk-virtio-scsi-reservations-not-managed.args | 28 +++
.../disk-virtio-scsi-reservations-not-managed.xml | 40 ++++
.../disk-virtio-scsi-reservations.args | 29 +++
.../disk-virtio-scsi-reservations.xml | 38 ++++
tests/qemuxml2argvtest.c | 8 +
.../disk-virtio-scsi-reservations-not-managed.xml | 1 +
.../disk-virtio-scsi-reservations.xml | 1 +
tests/qemuxml2xmltest.c | 4 +
29 files changed, 1042 insertions(+), 37 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations-not-managed.args
create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations-not-managed.xml
create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations.args
create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations.xml
create mode 120000
tests/qemuxml2xmloutdata/disk-virtio-scsi-reservations-not-managed.xml
create mode 120000 tests/qemuxml2xmloutdata/disk-virtio-scsi-reservations.xml
--
2.16.1