tools: systemd patches
cover tools: systemd patches
This small series tries to fix some problems in systemd stuffs.
The first patch was based on one of Olaf's email on fixing the clean target.
Patch 2 and 3 add a missing service to run xen-init-dom0. I don't have working SystemD setup to test it so it's only RFC. I basically Copy-n-paste from some existing service config to make up that one.
The basic thing is that we need to run xen-init-dom0 to generate JSON config stub for Dom0 before xendomains. xen-init-dom0 only needs to run once.
Wei.
Wei Liu (3):
systemd: fix clean target in Makefile
systemd: add xen-init-dom0 service
systemd: xendomains now depends on xen-init-dom0
tools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 2 ++ tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 14 ++++++++++++++ tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.in
Signature · 1 line
1.7.10.4
RFC PATCH 1/3 systemd: fix clean target in Makefile
--- tools/hotplug/Linux/systemd/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/hotplug/Linux/systemd/Makefile +1 -0
@@ -25,6 +25,7 @@ all: $(ALL_XEN_SYSTEMD) .PHONY: clean clean: + rm -f $(XEN_SYSTEMD_MODULES) .PHONY: install install: $(ALL_XEN_SYSTEMD)
Signature · 1 line
1.7.10.4
RFC PATCH 2/3 systemd: add xen-init-dom0 service
In reply to Wei LiuPlease rerun autoconf after applying this patch.
--- tools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 1 + tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.in
tools/configure.ac +1 -0
@@ -15,6 +15,7 @@ hotplug/Linux/init.d/xendomains hotplug/Linux/systemd/proc-xen.mount hotplug/Linux/systemd/var-lib-xenstored.mount hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service +hotplug/Linux/systemd/xen-init-dom0.service hotplug/Linux/systemd/xen-watchdog.service hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service
tools/hotplug/Linux/systemd/Makefile +1 -0
@@ -14,6 +14,7 @@ XEN_SYSTEMD_SERVICE += xenconsoled.service 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 ALL_XEN_SYSTEMD = $(XEN_SYSTEMD_MODULES) \ $(XEN_SYSTEMD_MOUNT) \
tools/hotplug/Linux/systemd/xen-init-dom0.service.in new file +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=xen-init-dom0, initialise JSON configuration stub for Dom0 +Requires=xenstored.socket +After=xenstored.service +ConditionVirtualization=xen + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStart=@LIBEXEC_BIN@/xen-init-dom0 + +[Install] +WantedBy=multi-user.target
Signature · 1 line
1.7.10.4
RFC PATCH 3/3 systemd: xendomains now depends on xen-init-dom0
In reply to Wei Liu--- tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/Linux/systemd/xendomains.service.in +1 -1
@@ -1,7 +1,7 @@ [Unit] Description=Xendomains - start and stop guests on boot and shutdown Requires=xenstored.socket -After=xenstored.service xenconsoled.service +After=xenstored.service xenconsoled.service xen-init-dom0.service ConditionVirtualization=xen [Service]
Signature · 1 line
1.7.10.4
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Wei LiuQuoted 1 line · Wei Liu
+ConditionVirtualization=xen
This should be "ConditionPathExists=/proc/xen/capabilities".
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Quoted 6 lines · Olaf Hering
Quoted 1 line · Wei Liu
+ConditionVirtualization=xen
This should be "ConditionPathExists=/proc/xen/capabilities".
OK. Just saw your other patches.
Other than this, did I get the Type= and RemainAfterExit= right?
Wei.
Quoted 1 line
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Wei LiuIf its still RFC stage, then how can we be sure that the JSON config file for dom0 is written to /var/lib/xen? /var/lib/xen/userdata-d.0.00000000-0000-0000-0000-000000000000.libxl-json
If its not there by the time xendomains starts then the rest of the patch can't help.
When I runxl list -l 0
I can see the same errors. libxl is trying to open the above file and get the JSON config for dom0. If I hack a stub config into this file everything starts working as expected. I can't modify xen-init-dom0.c
I have no idea how to make sure its writing the above JSON config. Can someone take a look? thanks,
Mark
BTW, I am willing to test a set of patches in C7+systemd twice a week. I noticed that git pull for unstable is populated mostly on Friday. So I will build at most on Tuesday and Friday.
On Monday, October 20, 2014 8:17 AM, Wei Liu <[email protected]> wrote:
Please rerun autoconf after applying this patch.
---
tools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 1 + tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 14 ++++++++++++++ 3 files changed, 16 insertions(+)
create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.in
tools/configure.ac +0 -0
@@ -15,6 +15,7 @@ hotplug/Linux/init.d/xendomains
hotplug/Linux/systemd/proc-xen.mount hotplug/Linux/systemd/var-lib-xenstored.mount hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service +hotplug/Linux/systemd/xen-init-dom0.service hotplug/Linux/systemd/xen-watchdog.service hotplug/Linux/systemd/xenconsoled.service hotplug/Linux/systemd/xendomains.service
tools/hotplug/Linux/systemd/Makefile +0 -0
@@ -14,6 +14,7 @@ XEN_SYSTEMD_SERVICE += xenconsoled.service
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
ALL_XEN_SYSTEMD = $(XEN_SYSTEMD_MODULES) \
$(XEN_SYSTEMD_MOUNT) \tools/hotplug/Linux/systemd/xen-init-dom0.service.in new file +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=xen-init-dom0, initialise JSON configuration stub for Dom0 +Requires=xenstored.socket +After=xenstored.service +ConditionVirtualization=xen + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStart=@LIBEXEC_BIN@/xen-init-dom0 + +[Install] +WantedBy=multi-user.target
Signature · 1 line
1.7.10.4
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Quoted 3 lines · Mark Pryor
If its still RFC stage, then how can we be sure that the JSON config file for dom0 is written to
/var/lib/xen?/var/lib/xen/userdata-d.0.00000000-0000-0000-0000-000000000000.libxl-json
You can delete that file before rebooting.
But this series alone won't work though. You need to remove two more lines in xenstored.service.
tools/hotplug/Linux/systemd/xenstored.service.in +0 -2
@@ -17,8 +17,6 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0
Quoted 8 lines
If its not there by the time xendomains starts then the rest of the patch can't help.
When I run
xl list -l 0
I can see the same errors. libxl is trying to open the above file and get the JSON config for dom0. If I hack a stub config into this file everything starts working as expected. I can't modifyxen-init-dom0.cI have no idea how to make sure its writing the above JSON config. Can someone take a look?
Delete that file before rebooting. xen-init-dom0 will create one when it runs.
Quoted 6 lines
thanks,
MarkBTW, I am willing to test a set of patches in C7+systemd twice a week. I noticed that
git pullfor unstable is populated mostly on Friday. So I will build at most on Tuesday and Friday.
That's fine. I'm pretty sure we're very close to the bottom of this problem. It's just one missing systemd service. But Olaf is still working on refining systemd stuffs, so you might as well just wait.
Wei.
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Wei,
removing the 2 lines in xenstored.service was key to let xen-init-dom0 do the right thing. The JSON file is now created at Xen start (before Xendomains starts).
I tested it by direct edits to systemd service file without a new build. xl list -l 0 also gives the expected results.
In logs, its different now (no more dom0 already setup) ---------- log ----------
13:41:05 c7dom0 xen-init-dom0: Done setting up Dom0
13:41:05 c7dom0 systemd: Started xen-init-dom0, initialise JSON configuration stub for Dom0.
---------- snip -------
thanks for getting to the bottom of this,
On Monday, October 20, 2014 1:27 PM, Wei Liu <[email protected]> wrote:
Quoted 3 lines · Mark Pryor
If its still RFC stage, then how can we be sure that the JSON config file for dom0 is written to
/var/lib/xen?/var/lib/xen/userdata-d.0.00000000-0000-0000-0000-000000000000.libxl-json
You can delete that file before rebooting.
But this series alone won't work though. You need to remove two more lines in xenstored.service.
tools/hotplug/Linux/systemd/xenstored.service.in +0 -0
@@ -17,8 +17,6 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0
Quoted 8 lines
If its not there by the time xendomains starts then the rest of the patch can't help.
When I run
xl list -l 0
I can see the same errors. libxl is trying to open the above file and get the JSON config for dom0. If I hack a stub config into this file everything starts working as expected. I can't modifyxen-init-dom0.cI have no idea how to make sure its writing the above JSON config. Can someone take a look?
Delete that file before rebooting. xen-init-dom0 will create one when it runs.
Wei.
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Quoted 11 lines · Mark Pryor
Wei,
removing the 2 lines in xenstored.service was key to let xen-init-dom0 do the right thing. The JSON file is now created at Xen start (before Xendomains starts).
I tested it by direct edits to systemd service file without a new build.
xl list -l 0also gives the expected results.In logs, its different now (no more
dom0 already setup) ---------- log ----------
Quoted 7 lines
13:41:05 c7dom0 xen-init-dom0: Done setting up Dom0
13:41:05 c7dom0 systemd: Started xen-init-dom0, initialise JSON configuration stub for Dom0.---------- snip -------
thanks for getting to the bottom of this,
Thanks for testing.
Wei.
Olaf Hering
Acked-byRe: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Wei Liutools/hotplug/Linux/systemd/xenstored.service.in ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities · line 21
Quoted 10 lines · Wei Liu
tools/hotplug/Linux/systemd/xenstored.service.in +0
-2@@ -17,8 +17,6 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0
This should have been in ae931f568fe9e91179f3ff3aab199a84d39a626b ("libxl: introduce helper to initialise Dom0").
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Wei LiuQuoted 1 line · Wei Liu
Other than this, did I get the Type= and RemainAfterExit= right?
I know very little about this, but it looks correct according to
http://www.freedesktop.org/software/systemd/man/systemd.service.html
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Olaf HeringQuoted 15 lines · Olaf Hering
tools/hotplug/Linux/systemd/xenstored.service.in ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities · line 21
Quoted 10 lines · Wei Liu
tools/hotplug/Linux/systemd/xenstored.service.in +0
-2@@ -17,8 +17,6 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0This should have been in
ae931f568fe9e91179f3ff3aab199a84d39a626b("libxl: introduce helper to initialise Dom0").
Since that commit didn't adjust the systemd integration I don't think that's right. I'm expecting Wei will include it in the eventual patch set to switch systemd over to the new helper.
Quoted 6 lines
Acked-by Olaf Hering <[email protected]>Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Quoted 17 lines · Ian Campbell
Quoted 15 lines · Olaf Hering
tools/hotplug/Linux/systemd/xenstored.service.in ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities · line 21
Quoted 10 lines · Wei Liu
tools/hotplug/Linux/systemd/xenstored.service.in +0
-2@@ -17,8 +17,6 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0" -ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0This should have been in
ae931f568fe9e91179f3ff3aab199a84d39a626b("libxl: introduce helper to initialise Dom0").
Quoted 4 lines
Since that commit didn't adjust the systemd integration I don't think that's right. I'm expecting Wei will include it in the eventual patch set to switch systemd over to the new helper.
Yes. I will submit a new series soon.
Quoted 7 lines
Quoted 6 lines
Acked-by Olaf Hering <[email protected]>Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Olaf HeringQuoted 8 lines · Olaf Hering
Quoted 1 line · Wei Liu
Other than this, did I get the Type= and RemainAfterExit= right?
I know very little about this, but it looks correct according to
http://www.freedesktop.org/software/systemd/man/systemd.service.html
Fair enough. I read the same document.
Wei.
Quoted 1 line
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
Tues Oct 21 build
a)Tried a build without a separate service for xen-init-dom0, but ran it as ExecStartPost from xenstored service.
Spent 1.5 hours:
reset unstable git
plan which patches to use
tuned a patch for goal a)
configure and build (no problem)
packaged RPM
disabled the xen-init-dom0 service & unstalled old RPM installed & tested new build
It worked and is compatibile with current systemd services
My notes, patches, & RPM (for C7 with systemd) are in the usual place
On Tuesday, October 21, 2014 2:20 AM, Wei Liu <[email protected]> wrote:
Quoted 8 lines · Olaf Hering
Quoted 1 line · Wei Liu
Other than this, did I get the Type= and RemainAfterExit= right?
I know very little about this, but it looks correct according to
http://www.freedesktop.org/software/systemd/man/systemd.service.html
Fair enough. I read the same document.
Wei.
Quoted 1 line
Olaf
Re: [PATCH RFC 1/3] systemd: fix clean target in Makefile
In reply to Wei LiuQuoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
In reply to Wei LiuQuoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>
This patch seems to be correct.
But, should nothing else depend on this? There doesn't seem to be an umbrella "all the stuff needed for xen" module. Maybe one isn't needed?
Ian.
Quoted 17 lines
--- tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/Linux/systemd/xendomains.service.in +1
-1@@ -1,7 +1,7 @@ [Unit] Description=Xendomains - start and stop guests on boot and shutdown Requires=xenstored.socket -After=xenstored.service xenconsoled.service +After=xenstored.service xenconsoled.service xen-init-dom0.service ConditionVirtualization=xen [Service]
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 7 lines · Ian Campbell
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>This patch seems to be correct.
But, should nothing else depend on this? There doesn't seem to be an umbrella "all the stuff needed for xen" module. Maybe one isn't needed?
Nice that you ask. I was already thinking of a xencommons.service which just depends on everything required. Its certainly possible to enable each manually. This is what I have in my INSTALL file:
Systemd support
===============
If the systemd development packages are available then the support for systemd will be enabled per default. It is required to manually enable the installed systemd service files. Systemd has dependency tracking, which means all dependencies wil be started automatically:
systemctl enable xen-qemu-dom0-disk-backend.service systemctl enable xen-init-dom0.service systemctl enable xenconsoled.service
Other optional services are:
systemctl enable xen-domains.service
systemctl enable xen-watchdog.service
Olaf
Re: [PATCH RFC 2/3] systemd: add xen-init-dom0 service
In reply to Mark PryorQuoted 5 lines · Mark Pryor
Tues Oct 21 build
a)Tried a build without a separate service for xen-init-dom0, but ran it as ExecStartPost from xenstored service.
While this might be a more direct approach, conceptually it's not very correct.
xen-init-dom0 does more than just writing xenstore nodes, and can potentially be dependent on by / depend on other services , so it should be a dedicated service IMHO.
Wei.
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
In reply to Olaf HeringQuoted 10 lines · Olaf Hering
Quoted 7 lines · Ian Campbell
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>This patch seems to be correct.
But, should nothing else depend on this? There doesn't seem to be an umbrella "all the stuff needed for xen" module. Maybe one isn't needed?
I once thought about this but wasn't quite sure. Given that I was quite new to systemd and we were approaching freeze I focused on fixing this one bug only. But since you asked, I think a xencommons service is sensible.
Quoted 4 lines
Nice that you ask. I was already thinking of a xencommons.service which just depends on everything required. Its certainly possible to enable each manually. This is what I have in my INSTALL file:
Is this suitable for 4.5? Do you can to take over my systemd patch series and work on it for 4.5? I'm fine with that.
Wei.
Quoted 18 lines
Systemd support
===============If the systemd development packages are available then the support for systemd will be enabled per default. It is required to manually enable the installed systemd service files. Systemd has dependency tracking, which means all dependencies wil be started automatically:
systemctl enable xen-qemu-dom0-disk-backend.service systemctl enable xen-init-dom0.service systemctl enable xenconsoled.service
Other optional services are:
systemctl enable xen-domains.service
systemctl enable xen-watchdog.serviceOlaf
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 14 lines · Wei Liu
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>This patch seems to be correct.
But, should nothing else depend on this? There doesn't seem to be an umbrella "all the stuff needed for xen" module. Maybe one isn't needed?
I once thought about this but wasn't quite sure. Given that I was quite new to systemd and we were approaching freeze I focused on fixing this one bug only. But since you asked, I think a xencommons service is sensible.
Quoted 8 lines
Quoted 4 lines
Nice that you ask. I was already thinking of a xencommons.service which just depends on everything required. Its certainly possible to enable each manually. This is what I have in my INSTALL file:
Is this suitable for 4.5? Do you can to take over my systemd patch series and work on it for 4.5? I'm fine with that.
Wei.
This systemd support is brand new for 4.5, and it would be lovely to get it working properly right from the start.
Quoted 1 line
From a release perspective, the risk is that systemd support will be
better/worse given specific patches, but there is no possibility of regressions compared to 4.4
~Andrew
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
In reply to Wei LiuQuoted 2 lines · Wei Liu
Is this suitable for 4.5? Do you can to take over my systemd patch series and work on it for 4.5? I'm fine with that.
Yes, I will fix any fallout.
Olaf
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 7 lines · Olaf Hering
Quoted 2 lines · Wei Liu
Is this suitable for 4.5? Do you can to take over my systemd patch series and work on it for 4.5? I'm fine with that.
Yes, I will fix any fallout.
Cool, thank you!
Wei.
Quoted 1 line
Olaf
Re: [PATCH RFC 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 10 lines · Wei Liu
Quoted 7 lines · Olaf Hering
Quoted 2 lines · Wei Liu
Is this suitable for 4.5? Do you can to take over my systemd patch series and work on it for 4.5? I'm fine with that.
Yes, I will fix any fallout.
Cool, thank you!
Lets put in the fixes then.
Would it also be good to CC Michael Young ([email protected]) on those patches since when he does the Xen 4.5 RPMs he might have to ditch/rebase his systemd patchset.
Thank you.
Quoted 9 lines
Wei.
Quoted 1 line
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel