tools/hotplug: Add native systemd xendriverdomain.service
authorRusty Bird <rustybird@openmailbox.org>
Thu, 7 Jul 2016 14:09:32 +0000 (14:09 +0000)
committerWei Liu <wei.liu2@citrix.com>
Fri, 8 Jul 2016 13:35:04 +0000 (14:35 +0100)
A dedicated Xen driver domain init service starts "xl devd" in domU. But
currently, it is only supplied in the form of a SysV init script, which
systemd users run through a backward compatiblity wrapper automatically
generated by systemd-sysv-generator. This patch adds a (naturally more
lightweight) native systemd unit to be used instead.

The xendriverdomain service is only relevant to domU, but should not run
in dom0. Therefore, the systemd unit uses "ConditionVirtualization=xen",
which evaluates to true in domU and (since systemd version 214, released
on 2014-06-11) to false in dom0. Users or distributors who need to be
compatible with even older systemd versions, but still want to prevent
"xl devd" startup in dom0, could add the following line in [Service]:
ExecStartPre=/bin/sh -c "! grep -q control_d /proc/xen/capabilities"

(Please rerun autogen.sh after applying this patch)

Signed-off-by: Rusty Bird <rustybird@openmailbox.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[ wei: rerun autogen.sh ]

tools/configure
tools/configure.ac
tools/hotplug/Linux/systemd/Makefile
tools/hotplug/Linux/systemd/xendriverdomain.service.in [new file with mode: 0644]

index 4c92fa266f5f4c1405bc62401c5bc42f66da13bd..5b5dccef38cf6f9b2deff7b38b1fea16e61a2eee 100755 (executable)
@@ -9670,7 +9670,7 @@ fi
 
 if test "x$systemd" = "xy"; then :
 
-    ac_config_files="$ac_config_files hotplug/Linux/systemd/proc-xen.mount hotplug/Linux/systemd/var-lib-xenstored.mount hotplug/Linux/systemd/xen-init-dom0.service hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service hotplug/Linux/systemd/xen-watchdog.service hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service hotplug/Linux/systemd/xenstored.socket hotplug/Linux/systemd/xenstored_ro.socket"
+    ac_config_files="$ac_config_files hotplug/Linux/systemd/proc-xen.mount hotplug/Linux/systemd/var-lib-xenstored.mount hotplug/Linux/systemd/xen-init-dom0.service hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service hotplug/Linux/systemd/xen-watchdog.service hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xendriverdomain.service hotplug/Linux/systemd/xenstored.service hotplug/Linux/systemd/xenstored.socket hotplug/Linux/systemd/xenstored_ro.socket"
 
 
 fi
@@ -10392,6 +10392,7 @@ do
     "hotplug/Linux/systemd/xen-watchdog.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xen-watchdog.service" ;;
     "hotplug/Linux/systemd/xenconsoled.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xenconsoled.service" ;;
     "hotplug/Linux/systemd/xendomains.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xendomains.service" ;;
+    "hotplug/Linux/systemd/xendriverdomain.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xendriverdomain.service" ;;
     "hotplug/Linux/systemd/xenstored.service") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xenstored.service" ;;
     "hotplug/Linux/systemd/xenstored.socket") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xenstored.socket" ;;
     "hotplug/Linux/systemd/xenstored_ro.socket") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/systemd/xenstored_ro.socket" ;;
index 8704927443fbeabadef6b6817b0e5c92ada32b42..87e14a8c98aeac311be5af266da25bf354521e3e 100644 (file)
@@ -436,6 +436,7 @@ AS_IF([test "x$systemd" = "xy"], [
     hotplug/Linux/systemd/xen-watchdog.service
     hotplug/Linux/systemd/xenconsoled.service
     hotplug/Linux/systemd/xendomains.service
+    hotplug/Linux/systemd/xendriverdomain.service
     hotplug/Linux/systemd/xenstored.service
     hotplug/Linux/systemd/xenstored.socket
     hotplug/Linux/systemd/xenstored_ro.socket
index 83e3b32f771ceccf9fd738c9bf73c1370f40b277..558e459a19ffaac64e0e1994ccb2bc208c85e282 100644 (file)
@@ -15,6 +15,7 @@ XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
 XEN_SYSTEMD_SERVICE += xendomains.service
 XEN_SYSTEMD_SERVICE += xen-watchdog.service
 XEN_SYSTEMD_SERVICE += xen-init-dom0.service
+XEN_SYSTEMD_SERVICE += xendriverdomain.service
 
 ALL_XEN_SYSTEMD =      $(XEN_SYSTEMD_MODULES)  \
                        $(XEN_SYSTEMD_MOUNT)    \
diff --git a/tools/hotplug/Linux/systemd/xendriverdomain.service.in b/tools/hotplug/Linux/systemd/xendriverdomain.service.in
new file mode 100644 (file)
index 0000000..c0cd454
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=Xen driver domain device daemon
+DefaultDependencies=no
+Requires=proc-xen.mount
+After=proc-xen.mount
+ConditionVirtualization=xen
+
+[Service]
+Type=forking
+ExecStart=@sbindir@/xl devd --pidfile=/var/run/xldevd.pid
+PIDFile=/var/run/xldevd.pid
+
+[Install]
+WantedBy=multi-user.target