* [PATCH 1/7] tools/hotplug: fix conditions in systemd service files for dom0
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:56 ` Wei Liu
2014-10-24 14:17 ` [PATCH 2/7] tools/hotplug: fix clean target in systemd Makefile Olaf Hering
` (6 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Olaf Hering, Wei Liu, Ian Campbell, Stefano Stabellini,
Ian Jackson, M A Young
ConditionVirtualization= checks if systemd runs in some sort of guest.
It is not supposed to detect host capabilities. The current
implementation happens to work because systemd-detect-virt from v208
returns also 'xen' in a dom0. In v210 and later 'none' is returned and
no service files will be started.
Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs
depends on /proc/xen, but should only be done for pvops because xenfs
exists only there. All other service files should not be started in
domU. The file /proc/xen/capabilities exists in both dom0 and domU in a
pvops kernel, but only in dom0 it contains 'control_d'. The existing
ExecStartPre= check will prevent starting in a domU.
ConditionVirtualization=!xen is true in a dom0. But this check is broken
in systemd v208, so its not used.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/hotplug/Linux/systemd/proc-xen.mount.in | 3 ++-
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in | 4 +++-
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 2 +-
tools/hotplug/Linux/systemd/xen-watchdog.service.in | 2 +-
tools/hotplug/Linux/systemd/xenconsoled.service.in | 2 +-
tools/hotplug/Linux/systemd/xendomains.service.in | 2 +-
tools/hotplug/Linux/systemd/xenstored.service.in | 2 +-
tools/hotplug/Linux/systemd/xenstored.socket.in | 2 +-
tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 2 +-
9 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/tools/hotplug/Linux/systemd/proc-xen.mount.in b/tools/hotplug/Linux/systemd/proc-xen.mount.in
index f0c4f3a..64ebe7f 100644
--- a/tools/hotplug/Linux/systemd/proc-xen.mount.in
+++ b/tools/hotplug/Linux/systemd/proc-xen.mount.in
@@ -1,6 +1,7 @@
[Unit]
Description=Mount /proc/xen files
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen
+ConditionPathExists=!/proc/xen/capabilities
RefuseManualStop=true
[Mount]
diff --git a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
index 44dfce8..6c46be3 100644
--- a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
+++ b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
@@ -1,6 +1,8 @@
[Unit]
Description=mount xenstore file system
-ConditionVirtualization=xen
+Requires=proc-xen.mount
+After=proc-xen.mount
+ConditionPathExists=/proc/xen/capabilities
RefuseManualStop=true
[Mount]
diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
index d3470fc..52101af 100644
--- a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
+++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
@@ -4,7 +4,7 @@ Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
After=xenstored.service xenconsoled.service
Before=xendomains.service libvirtd.service libvirt-guests.service
RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=simple
diff --git a/tools/hotplug/Linux/systemd/xen-watchdog.service.in b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
index ee77bf9..1eecd2a 100644
--- a/tools/hotplug/Linux/systemd/xen-watchdog.service.in
+++ b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
@@ -2,7 +2,7 @@
Description=Xen-watchdog - run xen watchdog daemon
Requires=proc-xen.mount
After=proc-xen.mount xendomains.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=forking
diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
index 7ca0264..6ab0fc1 100644
--- a/tools/hotplug/Linux/systemd/xenconsoled.service.in
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -2,7 +2,7 @@
Description=Xenconsoled - handles logging from guest consoles and hypervisor
Requires=xenstored.socket
After=xenstored.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=simple
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
index f88c336..2684df0 100644
--- a/tools/hotplug/Linux/systemd/xendomains.service.in
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -2,7 +2,7 @@
Description=Xendomains - start and stop guests on boot and shutdown
Requires=xenstored.socket
After=xenstored.service xenconsoled.service
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=oneshot
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
index 013e69e..0f0d77d 100644
--- a/tools/hotplug/Linux/systemd/xenstored.service.in
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -4,7 +4,7 @@ Requires=xenstored_ro.socket xenstored.socket proc-xen.mount var-lib-xenstored.m
After=proc-xen.mount var-lib-xenstored.mount
Before=libvirtd.service libvirt-guests.service
RefuseManualStop=true
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Service]
Type=notify
diff --git a/tools/hotplug/Linux/systemd/xenstored.socket.in b/tools/hotplug/Linux/systemd/xenstored.socket.in
index 461e4f4..9b28e74 100644
--- a/tools/hotplug/Linux/systemd/xenstored.socket.in
+++ b/tools/hotplug/Linux/systemd/xenstored.socket.in
@@ -1,6 +1,6 @@
[Unit]
Description=xenstore socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Socket]
ListenStream=/var/run/xenstored/socket
diff --git a/tools/hotplug/Linux/systemd/xenstored_ro.socket.in b/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
index 6ab5c28..80402b3 100644
--- a/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
+++ b/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
@@ -1,6 +1,6 @@
[Unit]
Description=xenstore ro socket
-ConditionVirtualization=xen
+ConditionPathExists=/proc/xen/capabilities
[Socket]
ListenStream=/var/run/xenstored/socket_ro
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 1/7] tools/hotplug: fix conditions in systemd service files for dom0
2014-10-24 14:17 ` [PATCH 1/7] tools/hotplug: fix conditions in systemd service files for dom0 Olaf Hering
@ 2014-10-24 14:56 ` Wei Liu
0 siblings, 0 replies; 17+ messages in thread
From: Wei Liu @ 2014-10-24 14:56 UTC (permalink / raw)
To: Olaf Hering
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, 2014 at 04:17:04PM +0200, Olaf Hering wrote:
> ConditionVirtualization= checks if systemd runs in some sort of guest.
> It is not supposed to detect host capabilities. The current
> implementation happens to work because systemd-detect-virt from v208
> returns also 'xen' in a dom0. In v210 and later 'none' is returned and
> no service files will be started.
>
> Adjust the checks to detect a dom0 vs. native boot. Mounting xenfs
> depends on /proc/xen, but should only be done for pvops because xenfs
> exists only there. All other service files should not be started in
> domU. The file /proc/xen/capabilities exists in both dom0 and domU in a
> pvops kernel, but only in dom0 it contains 'control_d'. The existing
> ExecStartPre= check will prevent starting in a domU.
>
> ConditionVirtualization=!xen is true in a dom0. But this check is broken
> in systemd v208, so its not used.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/7] tools/hotplug: fix clean target in systemd Makefile
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
2014-10-24 14:17 ` [PATCH 1/7] tools/hotplug: fix conditions in systemd service files for dom0 Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:17 ` [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service Olaf Hering
` (5 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, M A Young
From: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/hotplug/Linux/systemd/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
index 9c58b33..0c40a73 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -25,6 +25,7 @@ all: $(ALL_XEN_SYSTEMD)
.PHONY: clean
clean:
+ rm -f $(XEN_SYSTEMD_MODULES)
.PHONY: install
install: $(ALL_XEN_SYSTEMD)
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
2014-10-24 14:17 ` [PATCH 1/7] tools/hotplug: fix conditions in systemd service files for dom0 Olaf Hering
2014-10-24 14:17 ` [PATCH 2/7] tools/hotplug: fix clean target in systemd Makefile Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:32 ` Wei Liu
2014-10-24 14:17 ` [PATCH 4/7] tools/hotplug: xendomains now depends on xen-init-dom0 Olaf Hering
` (4 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, M A Young
From: Wei Liu <wei.liu2@citrix.com>
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 <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
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(-)
diff --git a/tools/configure.ac b/tools/configure.ac
index f584798..1ac63a3 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -14,6 +14,7 @@ hotplug/Linux/init.d/xencommons
hotplug/Linux/init.d/xendomains
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
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
index 0c40a73..51c10fe 100644
--- a/tools/hotplug/Linux/systemd/Makefile
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -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) \
diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
new file mode 100644
index 0000000..e947760
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
@@ -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
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
index 0f0d77d..45fc0f2 100644
--- a/tools/hotplug/Linux/systemd/xenstored.service.in
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -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
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service
2014-10-24 14:17 ` [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service Olaf Hering
@ 2014-10-24 14:32 ` Wei Liu
2014-10-24 14:40 ` Olaf Hering
0 siblings, 1 reply; 17+ messages in thread
From: Wei Liu @ 2014-10-24 14:32 UTC (permalink / raw)
To: Olaf Hering
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, 2014 at 04:17:06PM +0200, Olaf Hering wrote:
[...]
> index f584798..1ac63a3 100644
> --- a/tools/configure.ac
> +++ b/tools/configure.ac
> @@ -14,6 +14,7 @@ hotplug/Linux/init.d/xencommons
> hotplug/Linux/init.d/xendomains
> 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
> diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
> index 0c40a73..51c10fe 100644
> --- a/tools/hotplug/Linux/systemd/Makefile
> +++ b/tools/hotplug/Linux/systemd/Makefile
> @@ -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) \
> diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
> new file mode 100644
> index 0000000..e947760
> --- /dev/null
> +++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=xen-init-dom0, initialise Dom0 configuration (xenstore nodes, JSON configuration stub)
> +Requires=xenstored.socket
> +After=xenstored.service
Olaf, you forgot to change this...
Wei.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service
2014-10-24 14:32 ` Wei Liu
@ 2014-10-24 14:40 ` Olaf Hering
2014-10-24 14:48 ` Wei Liu
0 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:40 UTC (permalink / raw)
To: Wei Liu; +Cc: Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, Wei Liu wrote:
> On Fri, Oct 24, 2014 at 04:17:06PM +0200, Olaf Hering wrote:
> > +Requires=xenstored.socket
> > +After=xenstored.service
>
> Olaf, you forgot to change this...
Its in a later patch which does it all at once.
Olaf
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service
2014-10-24 14:40 ` Olaf Hering
@ 2014-10-24 14:48 ` Wei Liu
0 siblings, 0 replies; 17+ messages in thread
From: Wei Liu @ 2014-10-24 14:48 UTC (permalink / raw)
To: Olaf Hering
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, 2014 at 04:40:47PM +0200, Olaf Hering wrote:
> On Fri, Oct 24, Wei Liu wrote:
>
> > On Fri, Oct 24, 2014 at 04:17:06PM +0200, Olaf Hering wrote:
> > > +Requires=xenstored.socket
> > > +After=xenstored.service
> >
> > Olaf, you forgot to change this...
>
> Its in a later patch which does it all at once.
>
Yeah, Hit "send" too soon...
Wei.
> Olaf
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/7] tools/hotplug: xendomains now depends on xen-init-dom0
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
` (2 preceding siblings ...)
2014-10-24 14:17 ` [PATCH 3/7] tools/hotplug: add systemd xen-init-dom0 service Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:17 ` [PATCH 5/7] tools/hotplug: systemd xenstored dependencies Olaf Hering
` (3 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, M A Young
From: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/hotplug/Linux/systemd/xendomains.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
index 2684df0..3ed4892 100644
--- a/tools/hotplug/Linux/systemd/xendomains.service.in
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -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
ConditionPathExists=/proc/xen/capabilities
[Service]
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH 5/7] tools/hotplug: systemd xenstored dependencies
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
` (3 preceding siblings ...)
2014-10-24 14:17 ` [PATCH 4/7] tools/hotplug: xendomains now depends on xen-init-dom0 Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:56 ` Wei Liu
2014-10-24 14:17 ` [PATCH 6/7] tools/hotplug: every systemd service depends on proc-xen.mount Olaf Hering
` (2 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Olaf Hering, Wei Liu, Ian Campbell, Stefano Stabellini,
Ian Jackson, M A Young
Everything which uses xenstored does this via the socket. Update the
existing service files to enable the xenstored.socket with the Requires=
statement. And schedule startup of the given service files after the
socket is enabled with the After= statement.
Once something tries to access the socket systemd will launch xenstored.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 2 +-
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 2 +-
tools/hotplug/Linux/systemd/xenconsoled.service.in | 2 +-
tools/hotplug/Linux/systemd/xendomains.service.in | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
index e947760..3ed1633 100644
--- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
+++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=xen-init-dom0, initialise Dom0 configuration (xenstore nodes, JSON configuration stub)
Requires=xenstored.socket
-After=xenstored.service
+After=xenstored.socket
ConditionPathExists=/proc/xen/capabilities
[Service]
diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
index 52101af..0b9c2e5 100644
--- a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
+++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=qemu for xen dom0 disk backend
Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
-After=xenstored.service xenconsoled.service
+After=xenstored.socket xenconsoled.service
Before=xendomains.service libvirtd.service libvirt-guests.service
RefuseManualStop=true
ConditionPathExists=/proc/xen/capabilities
diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
index 6ab0fc1..d3b85a5 100644
--- a/tools/hotplug/Linux/systemd/xenconsoled.service.in
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Xenconsoled - handles logging from guest consoles and hypervisor
Requires=xenstored.socket
-After=xenstored.service
+After=xenstored.socket
ConditionPathExists=/proc/xen/capabilities
[Service]
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
index 3ed4892..214da7a 100644
--- a/tools/hotplug/Linux/systemd/xendomains.service.in
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Xendomains - start and stop guests on boot and shutdown
Requires=xenstored.socket
-After=xenstored.service xenconsoled.service xen-init-dom0.service
+After=xenstored.socket xenconsoled.service xen-init-dom0.service
ConditionPathExists=/proc/xen/capabilities
[Service]
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/7] tools/hotplug: systemd xenstored dependencies
2014-10-24 14:17 ` [PATCH 5/7] tools/hotplug: systemd xenstored dependencies Olaf Hering
@ 2014-10-24 14:56 ` Wei Liu
0 siblings, 0 replies; 17+ messages in thread
From: Wei Liu @ 2014-10-24 14:56 UTC (permalink / raw)
To: Olaf Hering
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, 2014 at 04:17:08PM +0200, Olaf Hering wrote:
> Everything which uses xenstored does this via the socket. Update the
> existing service files to enable the xenstored.socket with the Requires=
> statement. And schedule startup of the given service files after the
> socket is enabled with the After= statement.
> Once something tries to access the socket systemd will launch xenstored.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/7] tools/hotplug: every systemd service depends on proc-xen.mount
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
` (4 preceding siblings ...)
2014-10-24 14:17 ` [PATCH 5/7] tools/hotplug: systemd xenstored dependencies Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 14:57 ` Wei Liu
2014-10-24 14:17 ` [PATCH 7/7] tools/hotplug: add helper script to visualize systemd dependencies Olaf Hering
2014-10-24 18:19 ` [PATCH 0/7] tools/systemd fixes Konrad Rzeszutek Wilk
7 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel
Cc: Olaf Hering, Wei Liu, Ian Campbell, Stefano Stabellini,
Ian Jackson, M A Young
Every systemd service file uses /proc/xen/capabilites to check if it
runs in a dom0. Update every service file to enable proc-xen.mount with
the Requires= statement and schedule its startup with the After=
statement.
In some places var-lib-xenstored.mount is removed. This is ok because
its optional and this unit is enabled by xenstored itself. After all its
a private directory for xenstored.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/hotplug/Linux/systemd/xen-init-dom0.service.in | 4 ++--
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 4 ++--
tools/hotplug/Linux/systemd/xenconsoled.service.in | 4 ++--
tools/hotplug/Linux/systemd/xendomains.service.in | 4 ++--
tools/hotplug/Linux/systemd/xenstored.socket.in | 2 ++
tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 2 ++
6 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
index 3ed1633..4d4cb23 100644
--- a/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
+++ b/tools/hotplug/Linux/systemd/xen-init-dom0.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=xen-init-dom0, initialise Dom0 configuration (xenstore nodes, JSON configuration stub)
-Requires=xenstored.socket
-After=xenstored.socket
+Requires=xenstored.socket proc-xen.mount
+After=xenstored.socket proc-xen.mount
ConditionPathExists=/proc/xen/capabilities
[Service]
diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
index 0b9c2e5..1e21abb 100644
--- a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
+++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=qemu for xen dom0 disk backend
-Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
-After=xenstored.socket xenconsoled.service
+Requires=proc-xen.mount xenstored.socket
+After=proc-xen.mount xenstored.socket xenconsoled.service
Before=xendomains.service libvirtd.service libvirt-guests.service
RefuseManualStop=true
ConditionPathExists=/proc/xen/capabilities
diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
index d3b85a5..e6cb853 100644
--- a/tools/hotplug/Linux/systemd/xenconsoled.service.in
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Xenconsoled - handles logging from guest consoles and hypervisor
-Requires=xenstored.socket
-After=xenstored.socket
+Requires=proc-xen.mount xenstored.socket
+After=proc-xen.mount xenstored.socket
ConditionPathExists=/proc/xen/capabilities
[Service]
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
index 214da7a..757278f 100644
--- a/tools/hotplug/Linux/systemd/xendomains.service.in
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Xendomains - start and stop guests on boot and shutdown
-Requires=xenstored.socket
-After=xenstored.socket xenconsoled.service xen-init-dom0.service
+Requires=proc-xen.mount xenstored.socket
+After=proc-xen.mount xenstored.socket xenconsoled.service xen-init-dom0.service
ConditionPathExists=/proc/xen/capabilities
[Service]
diff --git a/tools/hotplug/Linux/systemd/xenstored.socket.in b/tools/hotplug/Linux/systemd/xenstored.socket.in
index 9b28e74..2e8ee04 100644
--- a/tools/hotplug/Linux/systemd/xenstored.socket.in
+++ b/tools/hotplug/Linux/systemd/xenstored.socket.in
@@ -1,5 +1,7 @@
[Unit]
Description=xenstore socket
+Requires=proc-xen.mount var-lib-xenstored.mount
+After=proc-xen.mount var-lib-xenstored.mount
ConditionPathExists=/proc/xen/capabilities
[Socket]
diff --git a/tools/hotplug/Linux/systemd/xenstored_ro.socket.in b/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
index 80402b3..140ad94 100644
--- a/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
+++ b/tools/hotplug/Linux/systemd/xenstored_ro.socket.in
@@ -1,5 +1,7 @@
[Unit]
Description=xenstore ro socket
+Requires=proc-xen.mount var-lib-xenstored.mount
+After=proc-xen.mount var-lib-xenstored.mount
ConditionPathExists=/proc/xen/capabilities
[Socket]
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 6/7] tools/hotplug: every systemd service depends on proc-xen.mount
2014-10-24 14:17 ` [PATCH 6/7] tools/hotplug: every systemd service depends on proc-xen.mount Olaf Hering
@ 2014-10-24 14:57 ` Wei Liu
0 siblings, 0 replies; 17+ messages in thread
From: Wei Liu @ 2014-10-24 14:57 UTC (permalink / raw)
To: Olaf Hering
Cc: Wei Liu, Ian Campbell, Stefano Stabellini, Ian Jackson, xen-devel,
M A Young
On Fri, Oct 24, 2014 at 04:17:09PM +0200, Olaf Hering wrote:
> Every systemd service file uses /proc/xen/capabilites to check if it
> runs in a dom0. Update every service file to enable proc-xen.mount with
> the Requires= statement and schedule its startup with the After=
> statement.
> In some places var-lib-xenstored.mount is removed. This is ok because
> its optional and this unit is enabled by xenstored itself. After all its
> a private directory for xenstored.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 7/7] tools/hotplug: add helper script to visualize systemd dependencies
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
` (5 preceding siblings ...)
2014-10-24 14:17 ` [PATCH 6/7] tools/hotplug: every systemd service depends on proc-xen.mount Olaf Hering
@ 2014-10-24 14:17 ` Olaf Hering
2014-10-24 15:00 ` Wei Liu
2014-10-24 18:19 ` [PATCH 0/7] tools/systemd fixes Konrad Rzeszutek Wilk
7 siblings, 1 reply; 17+ messages in thread
From: Olaf Hering @ 2014-10-24 14:17 UTC (permalink / raw)
To: xen-devel; +Cc: Olaf Hering, M A Young
A small helper to draw a graph with dot(1) and show it with display(1):
bash tools/hotplug/Linux/systemd/show_service_dependencies.sh \
tools/hotplug/Linux/systemd/*.in
A red line means Requires= aka "enable it"
A blue line means After=
A green line means Before=
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
.../Linux/systemd/show_service_dependencies.sh | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tools/hotplug/Linux/systemd/show_service_dependencies.sh b/tools/hotplug/Linux/systemd/show_service_dependencies.sh
new file mode 100644
index 0000000..e3e4c68
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/show_service_dependencies.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# dot(1) from graphviz, display(1) from ImageMagick
+# Usage: bash $0 tools/hotplug/Linux/systemd/*.in
+(
+echo " digraph systemd {"
+for file in "$@"
+do
+ if test -f "$file"
+ then
+ unit=${file##*/}
+ unit=${unit%.in}
+ requires="`grep ^Requires= $file | cut -f 2- -d =`"
+ before="`grep ^Before= $file | cut -f 2- -d =`"
+ after="`grep ^After= $file | cut -f 2- -d =`"
+ echo "\"$unit\" [fillcolor=lightgray color=black fontcolor=black style=filled];"
+ for i in $requires
+ do
+ echo "\"$i\" -> \"$unit\" [color=red];"
+ done
+ for i in $after
+ do
+ echo "\"$i\" -> \"$unit\" [color=blue];"
+ done
+ for i in $before
+ do
+ echo "\"$unit\" -> \"$i\" [color=green];"
+ done
+ fi
+done
+echo "}"
+) | dot -Tpng | display -
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 0/7] tools/systemd fixes
2014-10-24 14:17 [PATCH 0/7] tools/systemd fixes Olaf Hering
` (6 preceding siblings ...)
2014-10-24 14:17 ` [PATCH 7/7] tools/hotplug: add helper script to visualize systemd dependencies Olaf Hering
@ 2014-10-24 18:19 ` Konrad Rzeszutek Wilk
2014-10-27 10:45 ` Ian Campbell
7 siblings, 1 reply; 17+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-10-24 18:19 UTC (permalink / raw)
To: Olaf Hering, ian.campbell; +Cc: M A Young, xen-devel
On Fri, Oct 24, 2014 at 04:17:03PM +0200, Olaf Hering wrote:
> This series combines all outstanding changes for systemd service files.
> Right now the existing service files will work only with older systemd
> version (208?) which incorrectly set "ConditionVirtualization=xen" to
> true in a dom0. There is no support for detecting dom0 in systemd. The
> proper way to detect a dom0 is to check for control_d in
> /proc/xen/capabilities.
>
> The content of the patches is unchanged compared to what was sent out to
> the list already. A few patches are acked by IanC.
>
> New in this series is an update of the dependencies between services. As
> Anthony correctly pointed out its better to depend on xenstore.socket
> instead of xenstored.service.
>
> The last patch is a small helper to visualize dependencies. It made it
> easier for me to see whats going on, so its included here as well.
>
> Olaf
Ian,
If you are waiting for my comments, I am OK with all of those patches
going in. And Wei has Acked them so that is super!
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> Olaf Hering (4):
> tools/hotplug: fix conditions in systemd service files for dom0
> tools/hotplug: systemd xenstored dependencies
> tools/hotplug: every systemd service depends on proc-xen.mount
> tools/hotplug: add helper script to visualize systemd dependencies
>
> Wei Liu (3):
> tools/hotplug: fix clean target in systemd Makefile
> tools/hotplug: add systemd xen-init-dom0 service
> tools/hotplug: xendomains now depends on xen-init-dom0
>
> tools/configure.ac | 1 +
> tools/hotplug/Linux/systemd/Makefile | 2 ++
> tools/hotplug/Linux/systemd/proc-xen.mount.in | 3 ++-
> .../Linux/systemd/show_service_dependencies.sh | 31 ++++++++++++++++++++++
> .../Linux/systemd/var-lib-xenstored.mount.in | 4 ++-
> .../hotplug/Linux/systemd/xen-init-dom0.service.in | 14 ++++++++++
> .../systemd/xen-qemu-dom0-disk-backend.service.in | 6 ++---
> .../hotplug/Linux/systemd/xen-watchdog.service.in | 2 +-
> tools/hotplug/Linux/systemd/xenconsoled.service.in | 6 ++---
> tools/hotplug/Linux/systemd/xendomains.service.in | 6 ++---
> tools/hotplug/Linux/systemd/xenstored.service.in | 4 +--
> tools/hotplug/Linux/systemd/xenstored.socket.in | 4 ++-
> tools/hotplug/Linux/systemd/xenstored_ro.socket.in | 4 ++-
> 13 files changed, 70 insertions(+), 17 deletions(-)
> create mode 100644 tools/hotplug/Linux/systemd/show_service_dependencies.sh
> create mode 100644 tools/hotplug/Linux/systemd/xen-init-dom0.service.in
>
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH 0/7] tools/systemd fixes
2014-10-24 18:19 ` [PATCH 0/7] tools/systemd fixes Konrad Rzeszutek Wilk
@ 2014-10-27 10:45 ` Ian Campbell
0 siblings, 0 replies; 17+ messages in thread
From: Ian Campbell @ 2014-10-27 10:45 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: Olaf Hering, M A Young, xen-devel
On Fri, 2014-10-24 at 14:19 -0400, Konrad Rzeszutek Wilk wrote:
> On Fri, Oct 24, 2014 at 04:17:03PM +0200, Olaf Hering wrote:
> > This series combines all outstanding changes for systemd service files.
> > Right now the existing service files will work only with older systemd
> > version (208?) which incorrectly set "ConditionVirtualization=xen" to
> > true in a dom0. There is no support for detecting dom0 in systemd. The
> > proper way to detect a dom0 is to check for control_d in
> > /proc/xen/capabilities.
> >
> > The content of the patches is unchanged compared to what was sent out to
> > the list already. A few patches are acked by IanC.
> >
> > New in this series is an update of the dependencies between services. As
> > Anthony correctly pointed out its better to depend on xenstore.socket
> > instead of xenstored.service.
> >
> > The last patch is a small helper to visualize dependencies. It made it
> > easier for me to see whats going on, so its included here as well.
> >
> > Olaf
>
> Ian,
>
> If you are waiting for my comments, I am OK with all of those patches
> going in. And Wei has Acked them so that is super!
>
> Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 17+ messages in thread