]> xenbits.xensource.com Git - libvirt.git/commit
util: add APIs for facilitating use of systemd activation FDs
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 25 Jun 2019 12:03:56 +0000 (13:03 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 12 Jul 2019 15:55:39 +0000 (16:55 +0100)
commit5b8569dd6e284b9159c701e8bffafb196983fc4a
tree13afc6cad0c444a9b86180b914878dfbfb310a05
parentf8b3905edf6779d65737a4141da7efa3cc731206
util: add APIs for facilitating use of systemd activation FDs

When receiving multiple FDs from systemd during service activation it is
neccessary to identify which purpose each FD is used for. While this
could be inferred by looking for the specific IP ports or UNIX socket
paths, this requires the systemd config to always match what is expected
by the code. Using systemd FD names we can remove this restriction and
simply identify FDs based on an arbitrary name.

The FD names are passed by systemd in the LISTEN_FDNAMES env variable
which is populated with the socket unit file names, unless overriden
by using the FileDescriptorName setting.

This is supported since the system 227 release and unfortunately RHEL7
lacks this version. Thus the code has some back compat support whereby
we look at the TCP ports or the UNIX socket paths to identify what
socket maps to which name. This back compat code is written such that
is it easly deleted when we are able to mandate newer systemd.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/libvirt_private.syms
src/util/virsystemd.c
src/util/virsystemd.h
tests/virsystemdtest.c