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

[libvirt] [PATCH 2/6] systemd: honour $runstatedir in socket unit files



If a systemd socket uses /var/run in its path, systemd prints a warning
at runtime

[   15.139976] systemd[1]: /usr/lib/systemd/system/virtlockd.socket:5:
  ListenStream= references a path below legacy directory /var/run/,
  updating /var/run/libvirt/virtlockd-sock → /run/libvirt/virtlockd-sock;
  please update the unit file accordingly.

This minimal change updates the socket unit files to honour the
$runstatedir path.

There's no functional change by default yet since both expressions
expand to the same value.

Signed-off-by: Daniel P. Berrangé <berrange redhat com>
---
 src/Makefile.am                       | 2 +-
 src/locking/virtlockd-admin.socket.in | 2 +-
 src/locking/virtlockd.socket.in       | 2 +-
 src/logging/virtlogd-admin.socket.in  | 2 +-
 src/logging/virtlogd.socket.in        | 2 +-
 src/remote/Makefile.inc.am            | 4 ++++
 src/remote/libvirtd-admin.socket.in   | 2 +-
 src/remote/libvirtd-ro.socket.in      | 2 +-
 src/remote/libvirtd.conf.in           | 2 +-
 src/remote/libvirtd.socket.in         | 2 +-
 src/remote/test_libvirtd.aug.in       | 2 +-
 11 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 817a7ecf34..13b05f8440 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -93,7 +93,7 @@ DRIVER_SOURCES =
 man7_MANS =
 
 COMMON_UNIT_VARS = \
-	-e 's|[ ]localstatedir[@]|$(localstatedir)|g' \
+	-e 's|[ ]runstatedir[@]|$(runstatedir)|g' \
 	-e 's|[ ]sbindir[@]|$(sbindir)|g' \
 	-e 's|[ ]sysconfdir[@]|$(sysconfdir)|g' \
 	$(NULL)
diff --git a/src/locking/virtlockd-admin.socket.in b/src/locking/virtlockd-admin.socket.in
index cd7072238c..c66e0f9693 100644
--- a/src/locking/virtlockd-admin.socket.in
+++ b/src/locking/virtlockd-admin.socket.in
@@ -5,7 +5,7 @@ BindsTo=virtlockd.socket
 After=virtlockd.socket
 
 [Socket]
-ListenStream= localstatedir@/run/libvirt/virtlockd-admin-sock
+ListenStream= runstatedir@/libvirt/virtlockd-admin-sock
 Service=virtlockd.service
 SocketMode=0600
 
diff --git a/src/locking/virtlockd.socket.in b/src/locking/virtlockd.socket.in
index d701b27516..52014f45ec 100644
--- a/src/locking/virtlockd.socket.in
+++ b/src/locking/virtlockd.socket.in
@@ -3,7 +3,7 @@ Description=Virtual machine lock manager socket
 Before=libvirtd.service
 
 [Socket]
-ListenStream= localstatedir@/run/libvirt/virtlockd-sock
+ListenStream= runstatedir@/libvirt/virtlockd-sock
 SocketMode=0600
 
 [Install]
diff --git a/src/logging/virtlogd-admin.socket.in b/src/logging/virtlogd-admin.socket.in
index 672bd7470d..5c0fb1880e 100644
--- a/src/logging/virtlogd-admin.socket.in
+++ b/src/logging/virtlogd-admin.socket.in
@@ -5,7 +5,7 @@ BindsTo=virtlogd.socket
 After=virtlogd.socket
 
 [Socket]
-ListenStream= localstatedir@/run/libvirt/virtlogd-admin-sock
+ListenStream= runstatedir@/libvirt/virtlogd-admin-sock
 Service=virtlogd.service
 SocketMode=0600
 
diff --git a/src/logging/virtlogd.socket.in b/src/logging/virtlogd.socket.in
index ae48cdab9a..9749a33197 100644
--- a/src/logging/virtlogd.socket.in
+++ b/src/logging/virtlogd.socket.in
@@ -3,7 +3,7 @@ Description=Virtual machine log manager socket
 Before=libvirtd.service
 
 [Socket]
-ListenStream= localstatedir@/run/libvirt/virtlogd-sock
+ListenStream= runstatedir@/libvirt/virtlogd-sock
 SocketMode=0600
 
 [Install]
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index aca0b40140..abf04d998a 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -247,6 +247,7 @@ remote/libvirtd.conf: remote/libvirtd.conf.in
 		-e '/[ ]CUT_ENABLE_IP[@]/d' \
 		-e '/[ ]END[@]/d' \
 		-e 's|[ ]sysconfdir[@]|@sysconfdir@|' \
+		-e 's|[ ]runstatedir[@]|@runstatedir@|' \
 		-e 's|[ ]DAEMON_NAME[@]|libvirtd|' \
 		$< > $@
 
@@ -254,6 +255,7 @@ remote/virtproxyd.conf: remote/libvirtd.conf.in
 	$(AM_V_GEN)sed \
 		-e '/[ ]CUT_ENABLE_IP[@]/d' \
 		-e '/[ ]END[@]/d' \
+		-e 's|[ ]runstatedir[@]|@runstatedir@|' \
 		-e 's/[ ]DAEMON_NAME[@]/virtproxyd/' \
 		$< > $@
 
@@ -290,6 +292,7 @@ remote/test_libvirtd.aug: remote/test_libvirtd.aug.in \
 		-e '/[ ]CUT_ENABLE_IP[@]/d' \
 		-e '/[ ]END[@]/d' \
 		-e 's|[ ]sysconfdir[@]|@sysconfdir@|' \
+		-e 's|[ ]runstatedir[@]|@runstatedir@|' \
 		-e 's|[ ]DAEMON_NAME[@]|libvirtd|' \
 		-e 's|[ ]DAEMON_NAME_UC[@]|Libvirtd|' \
 		> $@ || rm -f $@
@@ -301,6 +304,7 @@ remote/test_virtproxyd.aug: remote/test_libvirtd.aug.in \
 		$(SED) \
 		-e '/[ ]CUT_ENABLE_IP[@]/d' \
 		-e '/[ ]END[@]/d' \
+		-e 's|[ ]runstatedir[@]|@runstatedir@|' \
 		-e 's/[ ]DAEMON_NAME[@]/virtproxyd/' \
 		-e 's/[ ]DAEMON_NAME_UC[@]/Virtproxyd/' \
 		> $@ || rm -f $@
diff --git a/src/remote/libvirtd-admin.socket.in b/src/remote/libvirtd-admin.socket.in
index dcce7fdc93..4129abc1ab 100644
--- a/src/remote/libvirtd-admin.socket.in
+++ b/src/remote/libvirtd-admin.socket.in
@@ -8,7 +8,7 @@ After= service@.socket
 [Socket]
 # The directory must match the @sysconfdir@/libvirt/@service  conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream= localstatedir@/run/libvirt/@sockprefix -admin-sock
+ListenStream= runstatedir@/libvirt/@sockprefix -admin-sock
 Service= service@.service
 SocketMode=0600
 
diff --git a/src/remote/libvirtd-ro.socket.in b/src/remote/libvirtd-ro.socket.in
index a287f78201..cb5e6bd60f 100644
--- a/src/remote/libvirtd-ro.socket.in
+++ b/src/remote/libvirtd-ro.socket.in
@@ -8,7 +8,7 @@ After= service@.socket
 [Socket]
 # The directory must match the @sysconfdir@/libvirt/@service  conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream= localstatedir@/run/libvirt/@sockprefix -sock-ro
+ListenStream= runstatedir@/libvirt/@sockprefix -sock-ro
 Service= service@.service
 SocketMode=0666
 
diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in
index 6969998306..fdef97f371 100644
--- a/src/remote/libvirtd.conf.in
+++ b/src/remote/libvirtd.conf.in
@@ -119,7 +119,7 @@
 # This setting is not required or honoured if using systemd socket
 # activation with systemd version >= 227
 #
-#unix_sock_dir = "/var/run/libvirt"
+#unix_sock_dir = "@runstatedir@/libvirt"
 
 
 
diff --git a/src/remote/libvirtd.socket.in b/src/remote/libvirtd.socket.in
index cb61409e23..df36df2125 100644
--- a/src/remote/libvirtd.socket.in
+++ b/src/remote/libvirtd.socket.in
@@ -6,7 +6,7 @@ Before= service@.service
 [Socket]
 # The directory must match the @sysconfdir@/libvirt/@service  conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream= localstatedir@/run/libvirt/@sockprefix -sock
+ListenStream= runstatedir@/libvirt/@sockprefix -sock
 Service= service@.service
 SocketMode=0666
 
diff --git a/src/remote/test_libvirtd.aug.in b/src/remote/test_libvirtd.aug.in
index fc9fb69b67..1e17397af6 100644
--- a/src/remote/test_libvirtd.aug.in
+++ b/src/remote/test_libvirtd.aug.in
@@ -13,7 +13,7 @@ module Test_ DAEMON_NAME@ =
         { "unix_sock_ro_perms" = "0777" }
         { "unix_sock_rw_perms" = "0770" }
         { "unix_sock_admin_perms" = "0700" }
-        { "unix_sock_dir" = "/var/run/libvirt" }
+        { "unix_sock_dir" = "@runstatedir@/libvirt" }
         { "auth_unix_ro" = "none" }
         { "auth_unix_rw" = "none" }
 @CUT_ENABLE_IP@
-- 
2.21.0


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