From: Olaf Hering <olaf@aepfle.de>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH 5/5] tools/hotplug: support XENSTORED_TRACE in systemd
Date: Mon, 8 Dec 2014 13:37:36 +0100 [thread overview]
Message-ID: <20141208123736.GA3691@aepfle.de> (raw)
In-Reply-To: <21633.41977.399042.691409@mariner.uk.xensource.com>
On Fri, Dec 05, Ian Jackson wrote:
> I think the only way to make this work properly is to factor the
> necessary parts out of init.d/xencommons into a new script which can
> be used by both xencommons and systemd. I'm not sure such a patch
> would be appropriate for 4.5 at this stage.
I came up with this, it appears to work in my testing. Will do more
testing later today.
Olaf
---
.gitignore | 1 +
tools/configure | 3 +-
tools/configure.ac | 1 +
tools/hotplug/Linux/Makefile | 2 ++
tools/hotplug/Linux/init.d/xencommons.in | 24 +------------
tools/hotplug/Linux/systemd/xenstored.service.in | 7 +---
tools/hotplug/Linux/xenstored.sh.in | 44 ++++++++++++++++++++++++
7 files changed, 52 insertions(+), 30 deletions(-)
create mode 100644 tools/hotplug/Linux/xenstored.sh.in
diff --git a/.gitignore b/.gitignore
index 8c8c06f..7e6884a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -153,6 +153,7 @@ tools/hotplug/Linux/vif-setup
tools/hotplug/Linux/xen-backend.rules
tools/hotplug/Linux/xen-hotplug-common.sh
tools/hotplug/Linux/xendomains
+tools/hotplug/Linux/xenstored.sh
tools/hotplug/NetBSD/rc.d/xencommons
tools/include/xen/*
tools/include/xen-foreign/*.(c|h|size)
diff --git a/tools/configure b/tools/configure
index b0aea0a..e72876c 100755
--- a/tools/configure
+++ b/tools/configure
@@ -2276,7 +2276,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog 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 hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service hotplug/Linux/systemd/xenstored.socket hotplug/Linux/systemd/xenstored_ro.socket hotplug/Linux/vif-setup hotplug/Linux/xen-backend.rules hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencom
mons"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/xen-watchdog 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 hotplug/Linux/systemd/xendomains.service hotplug/Linux/systemd/xenstored.service hotplug/Linux/systemd/xenstored.socket hotplug/Linux/systemd/xenstored_ro.socket hotplug/Linux/vif-setup hotplug/Linux/xen-backend.rules hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/Linux/xenstored.sh
hotplug/NetBSD/rc.d/xencommons"
ac_config_headers="$ac_config_headers config.h"
@@ -9585,6 +9585,7 @@ do
"hotplug/Linux/xen-backend.rules") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-backend.rules" ;;
"hotplug/Linux/xen-hotplug-common.sh") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xen-hotplug-common.sh" ;;
"hotplug/Linux/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xendomains" ;;
+ "hotplug/Linux/xenstored.sh") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/xenstored.sh" ;;
"hotplug/NetBSD/rc.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/NetBSD/rc.d/xencommons" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
diff --git a/tools/configure.ac b/tools/configure.ac
index 1ac63a3..8f198e8 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -26,6 +26,7 @@ hotplug/Linux/vif-setup
hotplug/Linux/xen-backend.rules
hotplug/Linux/xen-hotplug-common.sh
hotplug/Linux/xendomains
+hotplug/Linux/xenstored.sh
hotplug/NetBSD/rc.d/xencommons
])
AC_CONFIG_HEADERS([config.h])
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 1706c05..e9a1ef0 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -2,6 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
include $(XEN_ROOT)/tools/Rules.mk
# Init scripts.
+XENSTORED_LIBEXEC = xenstored.sh
XENDOMAINS_INITD = init.d/xendomains
XENDOMAINS_LIBEXEC = xendomains
XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
@@ -51,6 +52,7 @@ install-initd:
[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+ $(INSTALL_PROG) $(XENSTORED_LIBEXEC) $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
diff --git a/tools/hotplug/Linux/init.d/xencommons.in b/tools/hotplug/Linux/init.d/xencommons.in
index a1095c2..d03dd59 100644
--- a/tools/hotplug/Linux/init.d/xencommons.in
+++ b/tools/hotplug/Linux/init.d/xencommons.in
@@ -18,7 +18,6 @@
# Description: Starts and stops the daemons neeeded for xl/xend
### END INIT INFO
-XENSTORED=@XENSTORED@
BACKEND_MODULES="@LINUX_BACKEND_MODULES@"
. @XEN_SCRIPT_DIR@/hotplugpath.sh
@@ -64,28 +63,7 @@ do_start () {
if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
then
- test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
- rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
- test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
-
- if [ -n "$XENSTORED" ] ; then
- echo -n Starting $XENSTORED...
- $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
- else
- echo "No xenstored found"
- exit 1
- fi
-
- # Wait for xenstored to actually come up, timing out after 30 seconds
- while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
- echo -n .
- time=$(($time+1))
- sleep 1
- done
- echo
-
- # Exit if we timed out
- if ! [ $time -lt $timeout ] ; then
+ if ! ${LIBEXEC_BIN}/xenstored.sh --opt --pid-file --opt /var/run/xenstored.pid ; then
echo Could not start xenstored
exit 1
fi
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
index 0f0ac58..01f5726 100644
--- a/tools/hotplug/Linux/systemd/xenstored.service.in
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -8,13 +8,8 @@ ConditionPathExists=/proc/xen/capabilities
[Service]
Type=notify
-Environment=XENSTORED_ARGS=
-Environment=XENSTORED=@XENSTORED@
-EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
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"
+ExecStart=-@LIBEXEC_BIN@/xenstored.sh --exec --opt "--no-fork"
[Install]
WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/xenstored.sh.in b/tools/hotplug/Linux/xenstored.sh.in
new file mode 100644
index 0000000..11caf25
--- /dev/null
+++ b/tools/hotplug/Linux/xenstored.sh.in
@@ -0,0 +1,44 @@
+#!/bin/bash
+do_exec=
+ret=1
+declare -a opts
+while test $# -gt 0
+do
+ case "$1" in
+ --exec)
+ do_exec="exec"
+ ;;
+ --opt)
+ opts=(${opts[@]} "$2")
+ shift
+ ;;
+ esac
+ shift
+done
+
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
+
+XENSTORED=@XENSTORED@
+XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
+
+xencommons_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
+test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
+
+rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
+test -z "$XENSTORED_TRACE" || XENSTORED_TRACE_ARGS=" -T /var/log/xen/xenstored-trace.log"
+
+echo -n Starting $XENSTORED...
+if $do_exec $XENSTORED ${opts[@]} $XENSTORED_TRACE_ARGS $XENSTORED_ARGS
+then
+ # Wait for xenstored to actually come up, timing out after 30 seconds
+ while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
+ echo -n .
+ time=$(($time+1))
+ sleep 1
+ done
+ echo
+ if [ $time -lt $timeout ]; then
+ ret=0
+ fi
+fi
+exit ${ret}
next prev parent reply other threads:[~2014-12-08 12:37 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 12:05 [PATCH 0/5] tools/hotplug: systemd changes for 4.5 Olaf Hering
2014-12-05 12:05 ` [PATCH 1/5] tools/hotplug: move XENSTORED_MOUNT_CTX to sysconfig.xencommons Olaf Hering
2014-12-05 12:20 ` Ian Jackson
2014-12-05 12:26 ` Olaf Hering
2014-12-05 12:32 ` Olaf Hering
2014-12-05 12:43 ` Ian Jackson
2014-12-05 13:27 ` Olaf Hering
2014-12-05 15:01 ` Ian Jackson
2014-12-05 15:35 ` Anthony PERARD
2014-12-05 15:51 ` Olaf Hering
2014-12-05 16:09 ` Anthony PERARD
2014-12-05 12:05 ` [PATCH 2/5] tools/hotplug: use existing sysconfig file for xenconsoled Olaf Hering
2014-12-05 12:05 ` [PATCH 3/5] tools/hotplug: remove EnvironmentFile from xen-qemu-dom0-disk-backend.service Olaf Hering
2014-12-05 12:05 ` [PATCH 4/5] tools/hotplug: remove XENSTORED_ROOTDIR from service file Olaf Hering
2014-12-05 12:21 ` Ian Jackson
2014-12-05 12:05 ` [PATCH 5/5] tools/hotplug: support XENSTORED_TRACE in systemd Olaf Hering
2014-12-05 12:24 ` Ian Jackson
2014-12-05 12:30 ` Olaf Hering
2014-12-05 12:51 ` Ian Jackson
2014-12-05 13:31 ` Olaf Hering
2014-12-08 12:37 ` Olaf Hering [this message]
2014-12-09 16:09 ` Ian Jackson
2014-12-09 16:27 ` Olaf Hering
2014-12-09 16:46 ` Ian Jackson
2014-12-10 9:15 ` Olaf Hering
2014-12-10 10:02 ` Ian Campbell
2014-12-10 10:08 ` Olaf Hering
2014-12-10 17:52 ` Olaf Hering
2014-12-12 10:10 ` Ian Campbell
2014-12-12 11:37 ` Olaf Hering
2014-12-12 11:47 ` Ian Campbell
2014-12-12 12:08 ` M A Young
2014-12-12 12:12 ` Olaf Hering
2014-12-12 15:06 ` Olaf Hering
2014-12-10 18:01 ` Olaf Hering
2014-12-12 10:07 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141208123736.GA3691@aepfle.de \
--to=olaf@aepfle.de \
--cc=Ian.Jackson@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.