Compare commits
80 Commits
Author | SHA1 | Date |
---|---|---|
Cole Robinson | 7d77bf76aa | |
Fedora Release Engineering | 7f0f1b831e | |
Cole Robinson | d964be0097 | |
Cole Robinson | a2479f539e | |
Daniel P. Berrangé | c2c89ec6a3 | |
Daniel P. Berrangé | d61e2404ba | |
Daniel P. Berrangé | a2be167dfe | |
Daniel P. Berrangé | 15ca09e1da | |
Cole Robinson | 2cc07e6366 | |
Daniel P. Berrangé | 4dd4fe78a4 | |
Daniel P. Berrangé | 0bc22fb6f7 | |
Daniel P. Berrangé | 76097a6961 | |
Daniel P. Berrangé | 98cbf39fd3 | |
Daniel P. Berrangé | d670e246d0 | |
Igor Gnatenko | 50e7b9a91d | |
Daniel P. Berrangé | 5cbc0451ce | |
Igor Gnatenko | b420054636 | |
Fedora Release Engineering | 143fedee46 | |
Daniel P. Berrangé | 88887cac0f | |
Daniel P. Berrangé | 579afc99f2 | |
Daniel P. Berrangé | 7f5808b9d0 | |
Daniel P. Berrangé | 4df5f77071 | |
Daniel P. Berrangé | 1bdd527daf | |
Daniel P. Berrangé | e5fa1c00d2 | |
David Abdurachmanov | 18f7b8c79c | |
Daniel P. Berrangé | 782468f8e9 | |
Fedora Release Engineering | 202e7d9569 | |
Daniel P. Berrangé | 0676a07265 | |
Daniel P. Berrangé | f57ce74947 | |
Daniel P. Berrangé | 851cfde15b | |
Daniel P. Berrangé | 06123137eb | |
Igor Gnatenko | 6ccf3cb58c | |
Igor Gnatenko | 030ddaa4ef | |
Daniel P. Berrangé | a8886736c4 | |
Daniel P. Berrangé | 4fd635e537 | |
Daniel P. Berrangé | 6210c457fc | |
Iryna Shcherbina | 82926cfdf0 | |
Daniel P. Berrangé | e7a3ca6f6b | |
Daniel P. Berrangé | 1ae6f647b7 | |
Daniel P. Berrangé | 48941c011f | |
Igor Gnatenko | a3c4cc6f3d | |
Igor Gnatenko | 90fbcbd48f | |
Fedora Release Engineering | 6efd96d995 | |
Daniel P. Berrange | 21316e7a45 | |
Daniel P. Berrange | 8adbb7a402 | |
Daniel P. Berrange | 3f19d41908 | |
Daniel P. Berrange | 34da93e0c9 | |
Daniel P. Berrange | 208f506190 | |
Daniel P. Berrange | 0ca715cad9 | |
Cole Robinson | 0f5d8c1c22 | |
Daniel P. Berrange | a56bcbd063 | |
Daniel P. Berrange | 89c3fa751c | |
Daniel P. Berrange | 051644ffcb | |
Daniel P. Berrange | 2a9c282548 | |
Daniel P. Berrange | 2ae80af461 | |
Daniel P. Berrange | 7335ede0e1 | |
Florian Weimer | 6c92ba3805 | |
Daniel P. Berrange | 446f680673 | |
Daniel P. Berrange | 3f56aa2870 | |
Cole Robinson | 3cec91694f | |
Cole Robinson | cb0cfa566f | |
Petr Písař | a27acebf66 | |
Daniel P. Berrange | 99d3a0ca1a | |
Daniel P. Berrange | 9c962ebc4f | |
Daniel P. Berrange | 99cbbf6606 | |
Daniel P. Berrange | b73e509648 | |
Daniel P. Berrange | b23ff9c0f7 | |
Cole Robinson | 20f9ed9c4c | |
Daniel P. Berrange | 04cb28c315 | |
Daniel P. Berrange | a74ea318d1 | |
Fedora Release Engineering | 98ed6b4e36 | |
Daniel P. Berrange | 2c49d1fd11 | |
Igor Gnatenko | 6e7bca6631 | |
Daniel P. Berrange | 2fe145bb02 | |
Daniel P. Berrange | 10b7d235e3 | |
Daniel P. Berrange | 232e2e7de2 | |
Daniel P. Berrange | fb1e4b061e | |
Daniel P. Berrange | 0b1a013081 | |
Daniel P. Berrange | a972457f43 | |
Daniel P. Berrange | 67cfa34a05 |
|
@ -1,242 +0,0 @@
|
|||
From c0bc172383c2c955394589e5808457935ae06f1d Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 6 Jun 2016 15:03:27 +0100
|
||||
Subject: [PATCH] systemd: directly notify systemd instead of using sd_notify
|
||||
|
||||
The sd_notify method is used to tell systemd when libvirtd
|
||||
has finished starting up. All it does is send a datagram
|
||||
containing the string parameter to systemd on a UNIX socket
|
||||
named in the NOTIFY_SOCKET environment variable. Rather than
|
||||
pulling in the systemd libraries for this, just code the
|
||||
notification directly in libvirt as this is a stable ABI
|
||||
from systemd's POV which explicitly allows independant
|
||||
implementations:
|
||||
|
||||
See "Reimplementable Independently" column in the
|
||||
"$NOTIFY_SOCKET Daemon Notifications" row:
|
||||
|
||||
https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1314881
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
configure.ac | 2 --
|
||||
libvirt.spec.in | 12 -----------
|
||||
m4/virt-systemd-daemon.m4 | 34 ------------------------------
|
||||
src/Makefile.am | 4 ++--
|
||||
src/util/virsystemd.c | 53 ++++++++++++++++++++++++++++++++++++++++++-----
|
||||
5 files changed, 50 insertions(+), 55 deletions(-)
|
||||
delete mode 100644 m4/virt-systemd-daemon.m4
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f2554a4..12eb3b3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -256,7 +256,6 @@ LIBVIRT_CHECK_SANLOCK
|
||||
LIBVIRT_CHECK_SASL
|
||||
LIBVIRT_CHECK_SELINUX
|
||||
LIBVIRT_CHECK_SSH2
|
||||
-LIBVIRT_CHECK_SYSTEMD_DAEMON
|
||||
LIBVIRT_CHECK_UDEV
|
||||
LIBVIRT_CHECK_WIRESHARK
|
||||
LIBVIRT_CHECK_NSS
|
||||
@@ -2787,7 +2786,6 @@ LIBVIRT_RESULT_SANLOCK
|
||||
LIBVIRT_RESULT_SASL
|
||||
LIBVIRT_RESULT_SELINUX
|
||||
LIBVIRT_RESULT_SSH2
|
||||
-LIBVIRT_RESULT_SYSTEMD_DAEMON
|
||||
LIBVIRT_RESULT_UDEV
|
||||
LIBVIRT_RESULT_WIRESHARK
|
||||
LIBVIRT_RESULT_NSS
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index 8b88eef..b93a53c 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -79,7 +79,6 @@
|
||||
%define with_firewalld 0%{!?_without_firewalld:0}
|
||||
%define with_libssh2 0%{!?_without_libssh2:0}
|
||||
%define with_wireshark 0%{!?_without_wireshark:0}
|
||||
-%define with_systemd_daemon 0%{!?_without_systemd_daemon:0}
|
||||
%define with_pm_utils 1
|
||||
|
||||
# Finally set the OS / architecture specific special cases
|
||||
@@ -133,7 +132,6 @@
|
||||
# Fedora has systemd, libvirt still used sysvinit there.
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 7
|
||||
%define with_systemd 1
|
||||
- %define with_systemd_daemon 1
|
||||
%define with_pm_utils 0
|
||||
%endif
|
||||
|
||||
@@ -268,9 +266,6 @@ BuildRequires: python
|
||||
%if %{with_systemd}
|
||||
BuildRequires: systemd-units
|
||||
%endif
|
||||
-%if %{with_systemd_daemon}
|
||||
-BuildRequires: systemd-devel
|
||||
-%endif
|
||||
%if %{with_xen} || %{with_libxl}
|
||||
BuildRequires: xen-devel
|
||||
%endif
|
||||
@@ -1061,12 +1056,6 @@ rm -rf .git
|
||||
%define arg_wireshark --without-wireshark-dissector
|
||||
%endif
|
||||
|
||||
-%if %{with_systemd_daemon}
|
||||
- %define arg_systemd_daemon --with-systemd-daemon
|
||||
-%else
|
||||
- %define arg_systemd_daemon --without-systemd-daemon
|
||||
-%endif
|
||||
-
|
||||
%if %{with_pm_utils}
|
||||
%define arg_pm_utils --with-pm-utils
|
||||
%else
|
||||
@@ -1157,7 +1146,6 @@ rm -f po/stamp-po
|
||||
--with-driver-modules \
|
||||
%{?arg_firewalld} \
|
||||
%{?arg_wireshark} \
|
||||
- %{?arg_systemd_daemon} \
|
||||
%{?arg_pm_utils} \
|
||||
--with-nss-plugin \
|
||||
%{arg_packager} \
|
||||
diff --git a/m4/virt-systemd-daemon.m4 b/m4/virt-systemd-daemon.m4
|
||||
deleted file mode 100644
|
||||
index 8516e41..0000000
|
||||
--- a/m4/virt-systemd-daemon.m4
|
||||
+++ /dev/null
|
||||
@@ -1,34 +0,0 @@
|
||||
-dnl The libsystemd-daemon.so library
|
||||
-dnl
|
||||
-dnl Copyright (C) 2012-2013 Red Hat, Inc.
|
||||
-dnl
|
||||
-dnl This library is free software; you can redistribute it and/or
|
||||
-dnl modify it under the terms of the GNU Lesser General Public
|
||||
-dnl License as published by the Free Software Foundation; either
|
||||
-dnl version 2.1 of the License, or (at your option) any later version.
|
||||
-dnl
|
||||
-dnl This library is distributed in the hope that it will be useful,
|
||||
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-dnl Lesser General Public License for more details.
|
||||
-dnl
|
||||
-dnl You should have received a copy of the GNU Lesser General Public
|
||||
-dnl License along with this library. If not, see
|
||||
-dnl <http://www.gnu.org/licenses/>.
|
||||
-dnl
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_CHECK_SYSTEMD_DAEMON],[
|
||||
- LIBVIRT_CHECK_PKG([SYSTEMD_DAEMON], [libsystemd-daemon], [0.27.1])
|
||||
-
|
||||
- old_CFLAGS="$CFLAGS"
|
||||
- old_LIBS="$LIBS"
|
||||
- CFLAGS="$CFLAGS $SYSTEMD_DAEMON_CFLAGS"
|
||||
- LIBS="$LIBS $SYSTEMD_DAEMON_LIBS"
|
||||
- AC_CHECK_FUNCS([sd_notify])
|
||||
- CFLAGS="$old_CFLAGS"
|
||||
- LIBS="$old_LIBS"
|
||||
-])
|
||||
-
|
||||
-AC_DEFUN([LIBVIRT_RESULT_SYSTEMD_DAEMON],[
|
||||
- LIBVIRT_RESULT_LIB([SYSTEMD_DAEMON])
|
||||
-])
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index f3c9a14..f020b92 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1107,12 +1107,12 @@ libvirt_util_la_SOURCES = \
|
||||
libvirt_util_la_CFLAGS = $(CAPNG_CFLAGS) $(YAJL_CFLAGS) $(LIBNL_CFLAGS) \
|
||||
$(AM_CFLAGS) $(AUDIT_CFLAGS) $(DEVMAPPER_CFLAGS) \
|
||||
$(DBUS_CFLAGS) $(LDEXP_LIBM) $(NUMACTL_CFLAGS) \
|
||||
- $(SYSTEMD_DAEMON_CFLAGS) $(POLKIT_CFLAGS) $(GNUTLS_CFLAGS) \
|
||||
+ $(POLKIT_CFLAGS) $(GNUTLS_CFLAGS) \
|
||||
-I$(srcdir)/conf
|
||||
libvirt_util_la_LIBADD = $(CAPNG_LIBS) $(YAJL_LIBS) $(LIBNL_LIBS) \
|
||||
$(THREAD_LIBS) $(AUDIT_LIBS) $(DEVMAPPER_LIBS) \
|
||||
$(LIB_CLOCK_GETTIME) $(DBUS_LIBS) $(MSCOM_LIBS) $(LIBXML_LIBS) \
|
||||
- $(SECDRIVER_LIBS) $(NUMACTL_LIBS) $(SYSTEMD_DAEMON_LIBS) \
|
||||
+ $(SECDRIVER_LIBS) $(NUMACTL_LIBS) \
|
||||
$(POLKIT_LIBS)
|
||||
|
||||
|
||||
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
|
||||
index 4883f94..871db7e 100644
|
||||
--- a/src/util/virsystemd.c
|
||||
+++ b/src/util/virsystemd.c
|
||||
@@ -21,8 +21,9 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
-#ifdef WITH_SYSTEMD_DAEMON
|
||||
-# include <systemd/sd-daemon.h>
|
||||
+#include <sys/socket.h>
|
||||
+#ifdef HAVE_SYS_UN_H
|
||||
+# include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include "virsystemd.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include "virutil.h"
|
||||
#include "virlog.h"
|
||||
#include "virerror.h"
|
||||
+#include "virfile.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_SYSTEMD
|
||||
|
||||
@@ -480,9 +482,50 @@ int virSystemdTerminateMachine(const char *name)
|
||||
void
|
||||
virSystemdNotifyStartup(void)
|
||||
{
|
||||
-#ifdef WITH_SYSTEMD_DAEMON
|
||||
- sd_notify(0, "READY=1");
|
||||
-#endif
|
||||
+#ifdef HAVE_SYS_UN_H
|
||||
+ const char *path;
|
||||
+ const char *msg = "READY=1";
|
||||
+ int fd;
|
||||
+ struct sockaddr_un un = {
|
||||
+ .sun_family = AF_UNIX,
|
||||
+ };
|
||||
+ struct iovec iov = {
|
||||
+ .iov_base = (char *)msg,
|
||||
+ .iov_len = strlen(msg),
|
||||
+ };
|
||||
+ struct msghdr mh = {
|
||||
+ .msg_name = &un,
|
||||
+ .msg_namelen = sizeof(un),
|
||||
+ .msg_iov = &iov,
|
||||
+ .msg_iovlen = 1,
|
||||
+ };
|
||||
+
|
||||
+ if (!(path = virGetEnvBlockSUID("NOTIFY_SOCKET"))) {
|
||||
+ VIR_DEBUG("Skipping systemd notify, not requested");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* NB sun_path field is *not* NUL-terminated, hence >, not >= */
|
||||
+ if (strlen(path) > sizeof(un.sun_path)) {
|
||||
+ VIR_WARN("Systemd notify socket path '%s' too long", path);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(un.sun_path, path, strlen(path));
|
||||
+ if (un.sun_path[0] == '@')
|
||||
+ un.sun_path[0] = '\0';
|
||||
+
|
||||
+ fd = socket(AF_UNIX, SOCK_DGRAM, 0);
|
||||
+ if (fd < 0) {
|
||||
+ VIR_WARN("Unable to create socket FD");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (sendmsg(fd, &mh, MSG_NOSIGNAL) < 0)
|
||||
+ VIR_WARN("Failed to notify systemd");
|
||||
+
|
||||
+ VIR_FORCE_CLOSE(fd);
|
||||
+#endif /* HAVE_SYS_UN_H */
|
||||
}
|
||||
|
||||
static int
|
||||
--
|
||||
2.5.5
|
||||
|
2327
libvirt.spec
2327
libvirt.spec
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue