Re: [PATCH 00/23] Enable proper use of systemd socket activation with libvirtd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 27, 2019 at 10:54:29AM +0100, Daniel P. Berrangé wrote:
The libvirtd daemon has some support for systemd socket activation
from:

 commit 27a7081c2968ca0d7fbd590629b5a5303851f4a3
 Author: Martin Kletzander <mkletzan@xxxxxxxxxx>
 Date:   Tue Jul 15 15:28:53 2014 +0200

   daemon: support passing FDs from the calling process

   First FD is the RW unix socket to listen on, second one (if
   applicable) is the RO unix socket.

This was originally intended for use by the libvirt client when doing
auto-spawning of libvirtd, but we later deleted that client side code
in

 commit be78814ae07f092d9c4e71fd82dd1947aba2f029
 Author: Michal Privoznik <mprivozn@xxxxxxxxxx>
 Date:   Thu Apr 2 14:41:17 2015 +0200

   virNetSocketNewConnectUNIX: Use flocks when spawning a daemon

We never added systemd socket units before as we need libvirtd to start
on boot to perform autostart.

It was recently pointed out by Lennart that these two features are not
mutually exclusive though. Libvirtd can be set to start on boot, and
also have socket unit files.

The idea is that we start libvirtd on boot, perform autostart, and then
libvirtd can exit if nothing is running. The socket unit files are then
there to start it again when a mgmt app connects.


How do you deal with responding to QEMU events, for example proper support for
<on_poweroff>restart</on_poweroff> ?

This series implements that strategy. In doing so the current socket
activation support was rewritten to be more flexible, able to cope with
the admin socket and the TCP/TLS sockets, all passed in any order.

NB, I don't believe I have got the RPM upgrade procedure right yet. As
there are alot of scenario to test for upgrades, I need more validation
of that. The series is long enough now though, that it would benefit
from code review already

This socket activation is also going to be important when we split out
the daemons, as we will use the same libvirtd codebase for these new
daemons, simply compiled with different options.

Daniel P. Berrangé (23):
 locking,logging: put a strong dep from admin socket to main socket
 util: add helper API for getting UNIX path from socket address
 rpc: add helper API for getting UNIX path from socket object
 util: add VIR_AUTOSTRUCT for directly calling a struct free function
 util: add API for resolving socket service names
 util: add APIs for facilitating use of systemd activation FDs
 rpc: ensure all sockets bind to same port when service is NULL
 rpc: refactor RPC service constructors to share more code
 rpc: allow creating RPC service from an array of FDs
 rpc: avoid unlinking sockets passed in from systemd
 rpc: add helper APIs for adding services with systemd activation
 rpc: add API for checking whether an auth scheme is in use on a server
 remote: simplify libvirtd code for deciding if SASL auth is needed
 remote: fix handling of systemd activation wrt socket ordering
 rpc: remove unused API for creating services from FDs
 remote: add systemd socket units for UNIX/TCP sockets
 remote: make system libvirtd exit when idle via timeout
 remote: update config files to note usage wrt systemd socket
   activation
 util: remove code spawning with systemd activation env vars
 locking: convert lock daemon to use systemd activation APIs
 logging: convert log daemon to use systemd activation APIs
 util: move code for getting listen FDs into systemd module
 util: remove unused helper for getting UNIX socket path

libvirt.spec.in                       |  24 +-
src/libvirt_private.syms              |  10 +-
src/libvirt_remote.syms               |   7 +-
src/locking/lock_daemon.c             | 121 +++----
src/locking/virtlockd-admin.socket.in |   2 +
src/logging/log_daemon.c              | 121 +++----
src/logging/virtlogd-admin.socket.in  |   2 +
src/remote/Makefile.inc.am            |  35 +++
src/remote/libvirtd-admin.socket.in   |  15 +
src/remote/libvirtd-ro.socket.in      |  15 +
src/remote/libvirtd-tcp.socket.in     |  14 +
src/remote/libvirtd-tls.socket.in     |  14 +
src/remote/libvirtd.conf              |  31 ++
src/remote/libvirtd.service.in        |  16 +-
src/remote/libvirtd.socket.in         |  13 +
src/remote/libvirtd.sysconf           |   3 +-
src/remote/remote_daemon.c            | 255 +++++++--------
src/rpc/virnetserver.c                | 162 ++++++++++
src/rpc/virnetserver.h                |  26 ++
src/rpc/virnetserverservice.c         | 238 ++++++--------
src/rpc/virnetserverservice.h         |  24 +-
src/rpc/virnetsocket.c                |  93 ++++--
src/rpc/virnetsocket.h                |   2 +
src/util/viralloc.h                   |  13 +
src/util/vircommand.c                 |  99 ------
src/util/vircommand.h                 |   2 -
src/util/virsocketaddr.c              |  93 ++++++
src/util/virsocketaddr.h              |   4 +
src/util/virsystemd.c                 | 434 ++++++++++++++++++++++++++
src/util/virsystemd.h                 |  30 ++
src/util/virutil.c                    | 116 -------
src/util/virutil.h                    |   3 -
tests/commanddata/test24.log          |   8 -
tests/commandtest.c                   |  58 ----
tests/virsystemdtest.c                | 169 ++++++++++
35 files changed, 1490 insertions(+), 782 deletions(-)
create mode 100644 src/remote/libvirtd-admin.socket.in
create mode 100644 src/remote/libvirtd-ro.socket.in
create mode 100644 src/remote/libvirtd-tcp.socket.in
create mode 100644 src/remote/libvirtd-tls.socket.in
create mode 100644 src/remote/libvirtd.socket.in
delete mode 100644 tests/commanddata/test24.log

--
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux