SCSI persistent Reservations allow restricting access to block devices to specific initiators in a shared storage setup. When implementing clustering of virtual machines, it is a common requirement for virtual machines to send persistent reservation SCSI commands. However, the operating system restricts sending these commands to unprivileged programs because incorrect usage can disrupt regular operation of the storage fabric.
With these patches, the scsi-block and scsi-generic SCSI passthrough devices learn to delegate the implementation of persistent reservations to a separate object, the "persistent reservation manager". The persistent reservation manager talks to a separate privileged program, with a very simple protocol based on SCM_RIGHTS. In addition to invoking PERSISTENT RESERVATION OUT and PERSISTENT RESERVATION IN commands, the privileged component can also use libmpathpersist so that persistent reservations are applied to all paths in a multipath setting. Patch 1 defines the abstract QOM class and plugs it into block/file-posix.c. Patch 2 and 3 introduce the privileged helper program, while patch 4 defines the concrete QOM class that talks to it. Paolo v1->v2: removed scsi/ patches which were all reviewed removed man page (requires .texi while I used .rst for docs) qio_channel_read/write_all also went in independently fix installation of qemu-pr-helper man page fixes to documentation added BSD license to protocol header added handling of residual (buffer underrun) fixed closing of file descriptors on error block PERSISTENT RESERVE OUT for read-only file descriptors do not use g_assert use EXIT_SUCCESS/EXIT_FAILURE consistently moved all CONFIG_MPATH usage to the right patch drop CAP_SYS_ADMIN if multipath not compiled in simplify buffer size handling in multipath PERSISTENT RESERVE IN block REGISTER AND MOVE operation for multipath PERSISTENT RESERVE OUT fixed transport id handling in multipath PERSISTENT RESERVE OUT fixed string property double-free in pr-manager-helper fixed/cleaned up error handling in pr-manager-helper Paolo Bonzini (9): scsi, file-posix: add support for persistent reservation management scsi: build qemu-pr-helper scsi: add multipath support to qemu-pr-helper scsi: add persistent reservation manager using qemu-pr-helper Makefile | 14 +- configure | 59 ++- docs/interop/pr-helper.rst | 83 ++++ docs/pr-manager.rst | 60 +++ include/scsi/utils.h | 4 + scsi/Makefile.objs | 2 +- scsi/pr-helper.h | 41 ++ scsi/pr-manager-helper.c | 302 +++++++++++++ scsi/qemu-pr-helper.c | 1038 ++++++++++++++++++++++++++++++++++++++++++++ scsi/utils.c | 10 + 10 files changed, 1607 insertions(+), 6 deletions(-) -- 2.13.5