2729d79d | 03-Jul-2018 |
Michal Privoznik <mprivozn@redhat.com> |
pr-helper: Rework socket path handling
When reviewing Paolo's pr-helper patches I've noticed couple of problems:
1) socket_path needs to be calculated at two different places (one for printing out
pr-helper: Rework socket path handling
When reviewing Paolo's pr-helper patches I've noticed couple of problems:
1) socket_path needs to be calculated at two different places (one for printing out help, the other if socket activation is NOT used),
2) even though the default socket_path is allocated in compute_default_paths() it is the only default path the function handles. For instance, pidfile is allocated outside of this function. And yet again, at different places than 1)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Message-Id: <c791ba035f26ea957e8f3602e3009b621769b1ba.1530611283.git.mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
e2c81a45 | 28-Feb-2018 |
Paolo Bonzini <pbonzini@redhat.com> |
pr-manager-helper: report event on connection/disconnection
Let management know if there were any problems communicating with qemu-pr-helper. The event is edge-triggered, and is sent every time the
pr-manager-helper: report event on connection/disconnection
Let management know if there were any problems communicating with qemu-pr-helper. The event is edge-triggered, and is sent every time the connection status of the pr-manager-helper object changes.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
aad10040 | 26-Jun-2018 |
Paolo Bonzini <pbonzini@redhat.com> |
pr-manager-helper: avoid SIGSEGV when writing to the socket fail
When writing to the qemu-pr-helper socket failed, the persistent reservation manager was correctly disconnecting the socket, but it d
pr-manager-helper: avoid SIGSEGV when writing to the socket fail
When writing to the qemu-pr-helper socket failed, the persistent reservation manager was correctly disconnecting the socket, but it did not clear pr_mgr->ioc. So the rest of the code did not know that the socket had been disconnected, accessed pr_mgr->ioc and happily caused a crash.
To reproduce, it is enough to stop qemu-pr-helper between QEMU startup and executing e.g. sg_persist -k /dev/sdb.
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
86933b4e | 20-Jun-2018 |
Paolo Bonzini <pbonzini@redhat.com> |
pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN
The response size is expected to be zero if the SCSI status is not "GOOD", but nothing was resetting it.
This can be repro
pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN
The response size is expected to be zero if the SCSI status is not "GOOD", but nothing was resetting it.
This can be reproduced simply by "sg_persist -s /dev/sdb" where /dev/sdb in the guest is a scsi-block device corresponding to a multipath device on the host.
Before:
PR in (Read full status): Aborted command
and on the host:
prh_write_response: Assertion `resp->sz == 0' failed.
After:
PR in (Read full status): bad field in cdb or parameter list (perhaps unsupported service action)
Reported-by: Jiri Belka <jbelka@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
show more ...
|
bd6b1c83 | 03-Apr-2018 |
Michal Privoznik <mprivozn@redhat.com> |
qemu-pr-helper: Write pidfile more often
Let's write pidfile even if user did not request --daemon but they requested just --pidfile. Libvirt will use exactly this.
Signed-off-by: Michal Privoznik
qemu-pr-helper: Write pidfile more often
Let's write pidfile even if user did not request --daemon but they requested just --pidfile. Libvirt will use exactly this.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
9661e208 | 27-Nov-2017 |
Paolo Bonzini <pbonzini@redhat.com> |
scsi: replace hex constants with #defines
Sense keys have nice #defines in scsi/constants.h, use them.
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé
scsi: replace hex constants with #defines
Sense keys have nice #defines in scsi/constants.h, use them.
Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
fe8fc5ae | 22-Aug-2017 |
Paolo Bonzini <pbonzini@redhat.com> |
scsi: add multipath support to qemu-pr-helper
Proper support of persistent reservation for multipath devices requires communication with the multipath daemon, so that the reservation is registered a
scsi: add multipath support to qemu-pr-helper
Proper support of persistent reservation for multipath devices requires communication with the multipath daemon, so that the reservation is registered and applied when a path comes up. The device mapper utilities provide a library to do so; this patch makes qemu-pr-helper.c detect multipath devices and, when one is found, delegate the operation to libmpathpersist.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
b855f8d1 | 22-Aug-2017 |
Paolo Bonzini <pbonzini@redhat.com> |
scsi: build qemu-pr-helper
Introduce a privileged helper to run persistent reservation commands. This lets virtual machines send persistent reservations without using CAP_SYS_RAWIO or out-of-tree pa
scsi: build qemu-pr-helper
Introduce a privileged helper to run persistent reservation commands. This lets virtual machines send persistent reservations without using CAP_SYS_RAWIO or out-of-tree patches. The helper uses Unix permissions and SCM_RIGHTS to restrict access to processes that can access its socket and prove that they have an open file descriptor for a raw SCSI device.
The next patch will also correct the usage of persistent reservations with multipath devices.
It would also be possible to support for Linux's IOC_PR_* ioctls in the future, to support NVMe devices. For now, however, only SCSI is supported.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
7c9e5276 | 21-Aug-2017 |
Paolo Bonzini <pbonzini@redhat.com> |
scsi, file-posix: add support for persistent reservation management
It is a common requirement for virtual machine to send persistent reservations, but this currently requires either running QEMU wi
scsi, file-posix: add support for persistent reservation management
It is a common requirement for virtual machine to send persistent reservations, but this currently requires either running QEMU with CAP_SYS_RAWIO, or using out-of-tree patches that let an unprivileged QEMU bypass Linux's filter on SG_IO commands.
As an alternative mechanism, the next patches will introduce a privileged helper to run persistent reservation commands without expanding QEMU's attack surface unnecessarily.
The helper is invoked through a "pr-manager" QOM object, to which file-posix.c passes SG_IO requests for PERSISTENT RESERVE OUT and PERSISTENT RESERVE IN commands. For example:
$ qemu-system-x86_64 -device virtio-scsi \ -object pr-manager-helper,id=helper0,path=/var/run/qemu-pr-helper.sock -drive if=none,id=hd,driver=raw,file.filename=/dev/sdb,file.pr-manager=helper0 -device scsi-block,drive=hd
or:
$ qemu-system-x86_64 -device virtio-scsi \ -object pr-manager-helper,id=helper0,path=/var/run/qemu-pr-helper.sock -blockdev node-name=hd,driver=raw,file.driver=host_device,file.filename=/dev/sdb,file.pr-manager=helper0 -device scsi-block,drive=hd
Multiple pr-manager implementations are conceivable and possible, though only one is implemented right now. For example, a pr-manager could:
- talk directly to the multipath daemon from a privileged QEMU (i.e. QEMU links to libmpathpersist); this makes reservation work properly with multipath, but still requires CAP_SYS_RAWIO
- use the Linux IOC_PR_* ioctls (they require CAP_SYS_ADMIN though)
- more interestingly, implement reservations directly in QEMU through file system locks or a shared database (e.g. sqlite)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|