]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote: conditionalize systemd socket unit files
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 18 Jul 2019 15:34:41 +0000 (16:34 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 9 Aug 2019 13:06:31 +0000 (14:06 +0100)
Prepare for reusing libvirtd socket unit files with other daemons by
making various parts of their config conditionally defined by the make
rules.

Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/remote/Makefile.inc.am
src/remote/libvirtd-admin.socket.in
src/remote/libvirtd-ro.socket.in
src/remote/libvirtd-tcp.socket.in
src/remote/libvirtd-tls.socket.in
src/remote/libvirtd.socket.in

index 554fa4afe9ee5fc4f96d3051965ebaf47e03067e..6d29458a77c078073f6d9a8ac8bcc25fa876344f 100644 (file)
@@ -295,6 +295,10 @@ endif WITH_SASL
 
 LIBVIRTD_UNIT_VARS = \
        $(COMMON_UNIT_VARS) \
+       -e 's|[@]name[@]|Libvirt|g' \
+       -e 's|[@]service[@]|libvirtd|g' \
+       -e 's|[@]sockprefix[@]|libvirt|g' \
+       -e 's|[@]deps[@]||g' \
        $(NULL)
 
 libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
index bbab4ea355fd9738d23e5d2557c128ae3da8534a..dcce7fdc93efeb51fa72011a5582b4f82fc4ad60 100644 (file)
@@ -1,14 +1,15 @@
 [Unit]
-Description=Libvirt admin socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ admin socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
 
 [Socket]
-# The directory must match the @sysconfdir@/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-admin-sock
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-admin-sock
+Service=@service@.service
 SocketMode=0600
 
 [Install]
index 5f8b1892d59a7668051b18ab0c40ef17f001b009..a287f782018bd2514d17948a0679f599aabcd02f 100644 (file)
@@ -1,14 +1,15 @@
 [Unit]
-Description=Libvirt local read-only socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ local read-only socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
 
 [Socket]
-# The directory must match the @sysconfdir@/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-sock-ro
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-sock-ro
+Service=@service@.service
 SocketMode=0666
 
 [Install]
index 1103036c45af39bec7e367d9b9b0cc950c5cfc72..dd60317d47215113ad30af7e5edd8e0ea9fa3eca 100644 (file)
@@ -1,14 +1,15 @@
 [Unit]
-Description=Libvirt non-TLS IP socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ non-TLS IP socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
 
 [Socket]
-# This must match the @sysconfdir@/libvirt/libvirtd.conf tcp_port setting
+# This must match the @sysconfdir@/libvirt/@service@.conf tcp_port setting
 # when using systemd version < 227
 ListenStream=16509
-Service=libvirtd.service
+Service=@service@.service
 
 [Install]
 WantedBy=sockets.target
index e2b1f839dee9c8c6131de7490f124f500b3fafa5..8b89737fff317a26b387f815f3e744f87838995d 100644 (file)
@@ -1,14 +1,15 @@
 [Unit]
-Description=Libvirt TLS IP socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ TLS IP socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
 
 [Socket]
-# This must match the @sysconfdir@/libvirt/libvirtd.conf tls_port setting
+# This must match the @sysconfdir@/libvirt/@service@.conf tls_port setting
 # when using systemd version < 227
 ListenStream=16514
-Service=libvirtd.service
+Service=@service@.service
 
 [Install]
 WantedBy=sockets.target
index 872f70eb21b5ba4428a2daac53a08661a7bfd1aa..cb61409e232584dde373b52d8bfdb9a3d9b5098a 100644 (file)
@@ -1,12 +1,13 @@
 [Unit]
-Description=Libvirt local socket
-Before=libvirtd.service
+Description=@name@ local socket
+Before=@service@.service
+@deps@
 
 [Socket]
-# The directory must match the @sysconfdir@/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
 # when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-sock
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-sock
+Service=@service@.service
 SocketMode=0666
 
 [Install]