QEMU added support for SCSI persistent reservations. The way QEMU
implemented that makes it slightly harder for libvirt to adapt to - it's
a small binary that needs to start before qemu so that it can connect to
it. Basically, what libvirt does is:
1) start qemu-pr-helper (the small binary from above),
2) records its PID for tracking purposes
3) start qemu
and when shutting down a domain the process is reversed:
1) shut down qemu process,
2) kill qemu-pr-helper (PID was saved earlier).
Now, here also lies the last missing piece to he puzzle - what if
qemu-pr-helper dies while qemu is running? After some discussion with
Paolo it was agreed that qemu will emit an event for libvirt so that we
can respawn the process. Anyway, that shouldn't be a show stopper for
these patches (if it was the patch set might get too big).
Please test, review and comment.
As usual, you can find the patches on my github too:
https://github.com/zippy2/libvirt/tree/pr
Michal Privoznik (14):
virstoragefile: Introduce virStoragePRDef
qemuDomainDiskChangeSupported: Deny changing reservations
qemu: Introduce pr-manager-helper capability
qemu_domain: Introduce qemuDomainDiskPRObject
qemu: Generate alias for pr-helper
qemu: Store prAlias and prPath in status XML
qemu: Generate cmd line at startup
qemu: Introduce pr_helper to qemu.conf
qemu: Start PR daemons on domain startup
qemu: Track PR daemons PIDs in status XML
qemu_domain: Introduce qemuDomainGetPRUsageCount
qemu_process.c: Introduce qemuProcessSetupPRDaemon
qemu_hotplug: Hotplug of reservations
qemu_hotplug: Hotunplug of reservations
docs/formatdomain.html.in | 25 +-
docs/schemas/domaincommon.rng | 19 +-
docs/schemas/storagecommon.rng | 34 ++
m4/virt-driver-qemu.m4 | 5 +
src/conf/domain_conf.c | 36 ++
src/libvirt_private.syms | 4 +
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 | 59 +++
src/qemu/qemu_conf.c | 7 +-
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 435 ++++++++++++++++++++-
src/qemu/qemu_domain.h | 29 ++
src/qemu/qemu_hotplug.c | 110 ++++++
src/qemu/qemu_process.c | 160 ++++++++
src/qemu/qemu_process.h | 4 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/virstoragefile.c | 166 ++++++++
src/util/virstoragefile.h | 17 +
.../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, 1250 insertions(+), 19 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.13.6