From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xen.org
Cc: Juergen Gross <jgross@suse.com>,
wei.liu2@citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, ross.lagerwall@citrix.com,
dave@recoil.org
Subject: [PATCH v4 4/4] tools: make xenstore domain easy configurable
Date: Tue, 2 Aug 2016 12:39:28 +0200 [thread overview]
Message-ID: <1470134368-13799-5-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1470134368-13799-1-git-send-email-jgross@suse.com>
Add configuration entries to sysconfig.xencommons for selection of the
xenstore type (domain or daemon) and start the selected xenstore
service via a script called from sysvinit or systemd.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V3: - remove check for running xenstore domain, as this is done in
init-xenstore-domain already
- if booted with systemd send a systemd-notify message in the
xenstore domain case
- if booted with systemd don't wait until xenstore daemon is
running, as the daemon will have sent a notify message by its
own
- split up patch as requested by Ian Jackson
V2: - add .gitignore entry for launch-xenstore
---
tools/hotplug/Linux/init.d/sysconfig.xencommons.in | 42 ++++++++++++++++++++--
tools/hotplug/Linux/launch-xenstore.in | 42 ++++++++++++++++------
tools/hotplug/Linux/systemd/xenstored.service.in | 8 +----
3 files changed, 72 insertions(+), 20 deletions(-)
diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
index c27a476..cc8185c 100644
--- a/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
+++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in
@@ -6,12 +6,24 @@
#XENCONSOLED_TRACE=[none|guest|hv|all]
## Type: string
+## Default: daemon
+#
+# Select type of xentore service.
+#
+# This can be either of:
+# * daemon
+# * domain
+#
+# Changing this requires a reboot to take effect.
+#
+#XENSTORETYPE=daemon
+
+## Type: string
## Default: xenstored
#
# Select xenstore implementation, this can be either
-# of these below. If using systemd it's preferred that you
-# just edit the xenstored.service unit file and change
-# the XENSTORED variable there.
+# of these below.
+# Only evaluated if XENSTORETYPE is "daemon".
#
# This can be either of:
# * @sbindir@/oxenstored
@@ -26,21 +38,45 @@
# Additional commandline arguments to start xenstored,
# like "--trace-file @XEN_LOG_DIR@/xenstored-trace.log"
# See "@sbindir@/xenstored --help" for possible options.
+# Only evaluated if XENSTORETYPE is "daemon".
XENSTORED_ARGS=
## Type: string
## Default: Not defined, tracing off
#
# Log xenstored messages
+# Only evaluated if XENSTORETYPE is "daemon".
#XENSTORED_TRACE=[yes|on|1]
## Type: string
## Default: "@XEN_LIB_STORED@"
#
# Running xenstored on XENSTORED_ROOTDIR
+# Only evaluated if XENSTORETYPE is "daemon".
#XENSTORED_ROOTDIR=@XEN_LIB_STORED@
## Type: string
+## Default: @LIBEXEC@/boot/xenstore-stubdom.gz
+#
+# xenstore domain kernel.
+# Only evaluated if XENSTORETYPE is "domain".
+#XENSTORE_DOMAIN_KERNEL=@LIBEXEC@/boot/xenstore-stubdom.gz
+
+## Type: integer
+## Default: 8
+#
+# xenstore domain memory size in MiB.
+# Only evaluated if XENSTORETYPE is "domain".
+#XENSTORE_DOMAIN_SIZE=8
+
+## Type: string
+## Default: ""
+#
+# Additional arguments for starting the xenstore domain.
+# Only evaluated if XENSTORETYPE is "domain".
+XENSTORE_DOMAIN_ARGS=
+
+## Type: string
## Default: Not defined, xenbackendd debug mode off
#
# Running xenbackendd in debug mode
diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
index caa9345..cf98bd1 100644
--- a/tools/hotplug/Linux/launch-xenstore.in
+++ b/tools/hotplug/Linux/launch-xenstore.in
@@ -48,18 +48,40 @@ test_xenstore && exit 0
test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
-test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
-rm -f "$XENSTORED_ROOTDIR"/tdb* 2>/dev/null
-test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T @XEN_LOG_DIR@/xenstored-trace.log"
+[ "$XENSTORETYPE" = "" ] && XENSTORETYPE=daemon
+
+/bin/mkdir -p @XEN_RUN_DIR@
+
+[ "$XENSTORETYPE" = "daemon" ] && {
+ [ -z "$XENSTORED_ROOTDIR" ] && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
+ /bin/rm -f $XENSTORED_ROOTDIR/tdb* 2>/dev/null
+ [ -z "$XENSTORED_TRACE" ] || XENSTORED_ARGS="$XENSTORED_ARGS -T @XEN_LOG_DIR@/xenstored-trace.log"
+ [ -z "$XENSTORED" ] && XENSTORED=@XENSTORED@
+ [ -x "$XENSTORED" ] || {
+ echo "No xenstored found"
+ exit 1
+ }
-if [ -n "$XENSTORED" ] ; then
echo -n Starting $XENSTORED...
$XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
-else
- echo "No xenstored found"
- exit 1
-fi
-timeout_xenstore $XENSTORED || exit 1
+ systemd-notify --booted 2>/dev/null || timeout_xenstore $XENSTORED || exit 1
-exit 0
+ exit 0
+}
+
+[ "$XENSTORETYPE" = "domain" ] && {
+ [ -z "$XENSTORE_DOMAIN_KERNEL" ] && XENSTORE_DOMAIN_KERNEL=@LIBEXEC@/boot/xenstore-stubdom.gz
+ XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --kernel $XENSTORE_DOMAIN_KERNEL"
+ [ -z "$XENSTORE_DOMAIN_SIZE" ] && XENSTORE_DOMAIN_SIZE=8
+ XENSTORE_DOMAIN_ARGS="$XENSTORE_DOMAIN_ARGS --memory $XENSTORE_DOMAIN_SIZE"
+
+ echo -n Starting $XENSTORE_DOMAIN_KERNEL...
+ ${LIBEXEC_BIN}/init-xenstore-domain $XENSTORE_DOMAIN_ARGS || exit 1
+ systemd-notify --ready 2>/dev/null
+
+ exit 0
+}
+
+echo "illegal value $XENSTORETYPE for XENSTORETYPE"
+exit 1
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
index d520d70..80c1d40 100644
--- a/tools/hotplug/Linux/systemd/xenstored.service.in
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -10,14 +10,8 @@ ConditionPathExists=/proc/xen/capabilities
Type=notify
NotifyAccess=all
RemainAfterExit=true
-KillMode=none
-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=@XEN_SCRIPT_DIR@/launch-xenstore
[Install]
WantedBy=multi-user.target
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-02 10:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 10:39 [PATCH v4 0/4] tools: make xenstore domain/daemon configurable Juergen Gross
2016-08-02 10:39 ` [PATCH v4 1/4] tools: remove systemd xenstore socket definitions Juergen Gross
2016-08-02 11:07 ` Wei Liu
2016-08-02 19:45 ` David Scott
2016-08-02 10:39 ` [PATCH v4 2/4] tools: split out xenstored starting form xencommons Juergen Gross
2016-08-02 11:13 ` Wei Liu
2016-08-02 11:20 ` Juergen Gross
2016-08-02 11:39 ` Wei Liu
2016-08-02 13:48 ` Ian Jackson
2016-08-02 14:00 ` Wei Liu
2016-08-02 11:59 ` Olaf Hering
2016-08-02 12:08 ` Juergen Gross
2016-08-02 13:49 ` Ian Jackson
2016-08-02 10:39 ` [PATCH v4 3/4] tools: use pidfile for test if xenstored is running Juergen Gross
2016-08-02 11:14 ` Wei Liu
2016-08-02 10:39 ` Juergen Gross [this message]
2016-08-02 11:14 ` [PATCH v4 4/4] tools: make xenstore domain easy configurable Wei Liu
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=1470134368-13799-5-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dave@recoil.org \
--cc=ian.jackson@eu.citrix.com \
--cc=ross.lagerwall@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).