On Thu, Jun 27, 2019 at 10:54:35AM +0100, Daniel P. Berrangé wrote:
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.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/libvirt_private.syms | 5 +
src/util/virsystemd.c | 362 +++++++++++++++++++++++++++++++++++++++
src/util/virsystemd.h | 30 ++++
tests/virsystemdtest.c | 169 ++++++++++++++++++
4 files changed, 566 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 1adf735a38..ee1073e680 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3102,6 +3102,11 @@ virSysinfoReadS390;
# util/virsystemd.h
+virSystemdGetActivation;
+virSystemdActivationClaimFDs;
+virSystemdActivationComplete;
+virSystemdActivationFree;
+virSystemdActivationHasName;
virSystemdCanHibernate;
virSystemdCanHybridSleep;
virSystemdCanSuspend;
This hunk is not sorted properly.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano