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. 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 +- tools/hotplug/Linux/systemd/xenstored.service.in | 2 -- 5 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.in
Signature · 1 line
1.7.10.4
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
Re: [PATCH 1/3] systemd: fix clean target in Makefile
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>
I just acked the first copy of this before I noticed this newer one. Anyway:
Are you going to make a case for a release exception (for some or all of the series) to Konrad?
Quoted 16 lines
--- 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)
Re: [PATCH 1/3] systemd: fix clean target in Makefile
Quoted 9 lines · Ian Campbell
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>I just acked the first copy of this before I noticed this newer one. Anyway:
Acked-by Ian Campbell <[email protected]>Are you going to make a case for a release exception (for some or all of the series) to Konrad?
I believe this is a bug-fix so it can go in anytime.
Quoted 24 lines
Quoted 10 lines
--- tools/hotplug/Linux/systemd/Makefile | 1 + 1 file changed, 1 insertion(+)tools/hotplug/Linux/systemd/Makefile +0
-0tools/hotplug/Linux/systemd/Makefile all: $(ALL_XEN_SYSTEMD) · line 31
Quoted 7 lines
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)_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/3 systemd: add xen-init-dom0 service
In reply to Wei LiuAlso prevent xenstored.service from writing Dom0 nodes The initialisation is now done with xen-init-dom0.
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 ++++++++++++++ tools/hotplug/Linux/systemd/xenstored.service.in | 2 -- 4 files changed, 16 insertions(+), 2 deletions(-) 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 Dom0 configuration (xenstore nodes, JSON configuration stub) +Requires=xenstored.socket +After=xenstored.service +ConditionPathExists=/proc/xen/capabilities + +[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
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 [Install] WantedBy=multi-user.target
Signature · 1 line
1.7.10.4
Re: [PATCH 2/3] systemd: add xen-init-dom0 service
Quoted 6 lines · Wei Liu
Also prevent xenstored.service from writing Dom0 nodes The initialisation is now done with xen-init-dom0.
Please rerun autoconf after applying this patch.
Signed-off-by Wei Liu <[email protected]>
(didn't Olaf ack the previous?)
Re: [PATCH 2/3] systemd: add xen-init-dom0 service
In reply to Wei LiuQuoted 6 lines · Wei Liu
Also prevent xenstored.service from writing Dom0 nodes The initialisation is now done with xen-init-dom0.
Please rerun autoconf after applying this patch.
Signed-off-by Wei Liu <[email protected]>
I've tested this patch, and it works fine. It also looks good.
One would just need to adds "systemctl enable xen-init-dom0" in the doc, if there is one.
I just have one comment below.
Quoted 38 lines
--- tools/configure.ac | 1 + tools/hotplug/Linux/systemd/Makefile | 1 + tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 14 ++++++++++++++ tools/hotplug/Linux/systemd/xenstored.service.in | 2 -- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.intools/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.servicetools/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 +0
-0
tools/hotplug/Linux/systemd/xen-init-dom0.service.in line 4
Quoted 4 lines
tools/hotplug/Linux/systemd/xen-init-dom0.service.in new file +4
-0@@ -0,0 +1,14 @@ +[Unit] +Description=xen-init-dom0, initialise Dom0 configuration (xenstore nodes, JSON configuration stub) +Requires=xenstored.socket +After=xenstored.service
This two lines looks weird. I think they needs to be both the same.
Right now, I think systemd is ignoring the "After=" because xenstored.service is not yet on the list of services to start. But it will work because as soon as xen-init-dom0 is going to try to access xenstored, systemd is going to start it (because .socket).
So, IMHO, the right thing to do is either:
Requires=xenstored.socket
After=xenstored.socket
or:
Requires=xenstored.service
After=xenstored.service
Quoted 31 lines
tools/hotplug/Linux/systemd/xen-init-dom0.service.in new file +10
-0+ConditionPathExists=/proc/xen/capabilities + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStart=@LIBEXEC_BIN@/xen-init-dom0 + +[Install] +WantedBy=multi-user.targettools/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 [Install] WantedBy=multi-user.targetSignature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Signature · 1 line
Anthony PERARD
Re: [PATCH 2/3] systemd: add xen-init-dom0 service
Quoted 6 lines · Anthony PERARD
So, IMHO, the right thing to do is either:
Requires=xenstored.socket
After=xenstored.socket
or:
Requires=xenstored.service
After=xenstored.service
I agree with that.
Olaf
Re: [PATCH 2/3] systemd: add xen-init-dom0 service
Quoted 11 lines · Olaf Hering
Quoted 6 lines · Anthony PERARD
So, IMHO, the right thing to do is either:
Requires=xenstored.socket
After=xenstored.socket
or:
Requires=xenstored.service
After=xenstored.serviceI agree with that.
Then I (or you?) will need to fix other service files as well!
Anyway, I (or you?) should fix this as soon as possible.
Wei.
Quoted 1 line
Olaf
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 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 1 line · Wei Liu
Signed-off-by Wei Liu <[email protected]>
Re: [PATCH 3/3] systemd: xendomains now depends on xen-init-dom0
In reply to Wei LiuQuoted 10 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/Linux/systemd/xendomains.service.in +0
-0
tools/hotplug/Linux/systemd/xendomains.service.in line 5
Quoted 6 lines
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
Having a service listed in After does not mean a service depends on the other. It just mean: run xendomains.service after xen-init-dom0.service, but xen-init-dom0.service might not run at all..
If xen-init-dom0.service needs to be run before xendomains.service, you also need to add it to the Requires list.
So the patch should probably look like this:
-Requires=xenstored.socket
-After=xenstored.service xenconsoled.service +Requires=xenstored.socket xen-init-dom0.service +After=xenstored.service xenconsoled.service xen-init-dom0.service
(This also means, if xen-init-dom0 fail, xendomains will not be started at all.)
Signature · 1 line
Anthony PERARD
Re: [PATCH 3/3] systemd: xendomains now depends on xen-init-dom0
Quoted 22 lines · Anthony PERARD
Quoted 10 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>--- tools/hotplug/Linux/systemd/xendomains.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/Linux/systemd/xendomains.service.in +0
-0tools/hotplug/Linux/systemd/xendomains.service.in line 5
Quoted 6 lines
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=xenHaving a service listed in After does not mean a service depends on the other. It just mean: run xendomains.service after xen-init-dom0.service, but xen-init-dom0.service might not run at all..
Quoted 3 lines
If xen-init-dom0.service needs to be run before xendomains.service, you also need to add it to the Requires list.
Then I must have misread the manual
"After= ensures that the configured unit is started after the listed unit finished starting up"
Looks like "finished starting up" doesn't guarantee it exits with success?
Quoted 9 lines
So the patch should probably look like this:
tools/hotplug/Linux/systemd/xendomains.service.in +2
-2-Requires=xenstored.socket -After=xenstored.service xenconsoled.service +Requires=xenstored.socket xen-init-dom0.service +After=xenstored.service xenconsoled.service xen-init-dom0.service(This also means, if xen-init-dom0 fail, xendomains will not be started at all.)
Anyway, this looks sensible and it's what I expect. I will add in that line.
Wei.
Quoted 2 lines
Signature · 1 line
Anthony PERARD