tools/hotplug: Add native systemd xendriverdomain.service
PATCH v2 1/1 tools/hotplug: Add native systemd xendriverdomain.service
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)
---
Changed since v1:
* more detailed commit message
tools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 1 + tools/hotplug/Linux/systemd/xendriverdomain.service.in | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 tools/hotplug/Linux/systemd/xendriverdomain.service.in
tools/configure.ac +1 -0
@@ -437,6 +437,7 @@ AS_IF([test "x$systemd" = "xy"], [ hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service + hotplug/Linux/systemd/xendriverdomain.service hotplug/Linux/systemd/xenstored.socket hotplug/Linux/systemd/xenstored_ro.socket ])
tools/hotplug/Linux/systemd/Makefile +1 -0
@@ -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) \
tools/hotplug/Linux/systemd/xendriverdomain.service.in new file +14 -0
@@ -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
Signature · 7 lines
2.5.5 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 14 lines · Rusty Bird
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 -qcontrol_d/proc/xen/capabilities"
Quoted 5 lines
(Please rerun
autogen.shafter applying this patch)Signed-off-by Rusty Bird <[email protected]>Cc Ian Jackson <[email protected]>Cc Wei Liu <[email protected]>
Thanks, the commit message is clearer now.
Quoted 15 lines
---
Changed since v1:
* more detailed commit messagetools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 1 + tools/hotplug/Linux/systemd/xendriverdomain.service.in | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 tools/hotplug/Linux/systemd/xendriverdomain.service.intools/configure.ac +0
-0
tools/configure.ac AS_IF([test "x$systemd" = "xy"], [ · line 440
Quoted 4 lines
tools/configure.ac +1
-0@@ -437,6 +437,7 @@ AS_IF([test "x$systemd" = "xy"], [ hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service + hotplug/Linux/systemd/xendriverdomain.service
I failed to mention that I would like to sort this list alphabetically, i.e. the new addition should be moved before xenstored.service. I can make the adjustment while committing if you don't object.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu:
Quoted 5 lines
Quoted 5 lines
tools/configure.ac +0
-0@@ -437,6 +437,7 @@ AS_IF([test "x$systemd" = "xy"], [
Quoted 8 lines
tools/configure.ac AS_IF([test "x$systemd" = "xy"], [ · line 440
Quoted 4 lines
tools/configure.ac +1
-0hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service + hotplug/Linux/systemd/xendriverdomain.serviceI failed to mention that I would like to sort this list alphabetically, i.e. the new addition should be moved before xenstored.service. I can make the adjustment while committing if you don't object.
Of course, thank you!
Rusty
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel