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.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-08-20 11:57:46 +01:00
parent 893bf07274
commit cc5311e730
11 changed files with 14 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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]

View File

@ -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 $@

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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@