tools: split out xenstored starting form xencommons
authorJuergen Gross <jgross@suse.com>
Tue, 2 Aug 2016 16:10:45 +0000 (18:10 +0200)
committerWei Liu <wei.liu2@citrix.com>
Fri, 5 Aug 2016 09:37:09 +0000 (10:37 +0100)
In order to prepare starting a xenstore domain split out the starting
of the xenstore daemon from the xencommons script into a dedicated
launch-xenstore script.

A rerun of autogen.sh is required.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
.gitignore
tools/configure
tools/configure.ac
tools/hotplug/Linux/Makefile
tools/hotplug/Linux/init.d/xencommons.in
tools/hotplug/Linux/launch-xenstore.in [new file with mode: 0644]

index 9b8dece3d13233b2821df3ebe09048609b62b6a3..d193820a5329845e9caa32c647770171098ca400 100644 (file)
@@ -157,6 +157,7 @@ tools/hotplug/Linux/init.d/xen-watchdog
 tools/hotplug/Linux/init.d/xencommons
 tools/hotplug/Linux/init.d/xendomains
 tools/hotplug/Linux/init.d/xendriverdomain
+tools/hotplug/Linux/launch-xenstore
 tools/hotplug/Linux/systemd/*.conf
 tools/hotplug/Linux/systemd/*.mount
 tools/hotplug/Linux/systemd/*.socket
index 1c84c6c025a0f18f3152a7ed5e8373a18595683c..51f16c5393c60c05f7a775b4006fb76f1acc2f08 100755 (executable)
@@ -2410,7 +2410,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in ocaml/xenstored/oxenstored.conf"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/FreeBSD/rc.d/xencommons hotplug/FreeBSD/rc.d/xendriverdomain hotplug/Linux/init.d/sysconfig.xencommons hotplug/Linux/init.d/sysconfig.xendomains hotplug/Linux/init.d/xen-watchdog hotplug/Linux/init.d/xencommons hotplug/Linux/init.d/xendomains hotplug/Linux/init.d/xendriverdomain hotplug/Linux/launch-xenstore hotplug/Linux/vif-setup hotplug/Linux/xen-hotplug-common.sh hotplug/Linux/xendomains hotplug/NetBSD/rc.d/xencommons hotplug/NetBSD/rc.d/xendriverdomain libxl/xenlight.pc.in libxl/xlutil.pc.in ocaml/xenstored/oxenstored.conf"
 
 ac_config_headers="$ac_config_headers config.h"
 
@@ -10376,6 +10376,7 @@ do
     "hotplug/Linux/init.d/xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xencommons" ;;
     "hotplug/Linux/init.d/xendomains") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendomains" ;;
     "hotplug/Linux/init.d/xendriverdomain") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xendriverdomain" ;;
+    "hotplug/Linux/launch-xenstore") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/launch-xenstore" ;;
     "hotplug/Linux/vif-setup") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/vif-setup" ;;
     "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" ;;
index f991ab312818f0ff9b286cc44eeddf4048837735..3a4abb5357d0ab6429e1c4ac760eb5a94d166d1d 100644 (file)
@@ -15,6 +15,7 @@ hotplug/Linux/init.d/xen-watchdog
 hotplug/Linux/init.d/xencommons
 hotplug/Linux/init.d/xendomains
 hotplug/Linux/init.d/xendriverdomain
+hotplug/Linux/launch-xenstore
 hotplug/Linux/vif-setup
 hotplug/Linux/xen-hotplug-common.sh
 hotplug/Linux/xendomains
index 6d6cceea7515fb84d41191cba9fcbe25fedcbf65..29280cbaefd5675fbe90ea11c68a138e14cb7003 100644 (file)
@@ -30,6 +30,7 @@ XEN_SCRIPTS += block-drbd-probe
 XEN_SCRIPTS += block-dummy
 XEN_SCRIPTS += $(XEN_SCRIPTS-y)
 XEN_SCRIPTS += colo-proxy-setup
+XEN_SCRIPTS += launch-xenstore
 
 SUBDIRS-$(CONFIG_SYSTEMD) += systemd
 
index 2d8f30b88ac583cc9cff7dd6ef1b22e755389688..a32608cf4501b51110f8e56577a0406ef4b47758 100644 (file)
@@ -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
@@ -53,8 +52,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 do_start () {
-        local time=0
-       local timeout=30
        local mod
 
        for mod in $BACKEND_MODULES ; do modprobe "$mod" &>/dev/null ; done
@@ -62,37 +59,10 @@ do_start () {
        mkdir -p ${XEN_RUN_DIR}
        mkdir -p ${XEN_LOCK_DIR}
 
-       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 @XEN_LOG_DIR@/xenstored-trace.log"
-
-               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
-
-               # 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
-                   echo Could not start xenstored
-                   exit 1
-               fi
-
-               echo Setting domain 0 name, domid and JSON config...
-               ${LIBEXEC_BIN}/xen-init-dom0
-       fi
+       @XEN_SCRIPT_DIR@/launch-xenstore || exit 1
+
+       echo Setting domain 0 name, domid and JSON config...
+       ${LIBEXEC_BIN}/xen-init-dom0
 
        echo Starting xenconsoled...
        test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
diff --git a/tools/hotplug/Linux/launch-xenstore.in b/tools/hotplug/Linux/launch-xenstore.in
new file mode 100644 (file)
index 0000000..61541be
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Copyright (c) 2016 SUSE Linux GmbH
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; If not, see <http://www.gnu.org/licenses/>.
+#
+
+XENSTORED=@XENSTORED@
+
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
+test -f @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons && . @CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons
+
+time=0
+timeout=30
+
+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 @XEN_LOG_DIR@/xenstored-trace.log"
+
+       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
+
+       # 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
+           echo Could not start xenstored
+           exit 1
+       fi
+fi
+
+exit 0