versions of those scripts, so that you can copy the dist directory
to another machine and install from that distribution.
+xenstore: xenstored and oxenstored
+====================================
+
+Xen uses a configuration database called xenstore [0] to maintain configuration
+and status information shared between domains. A daemon is implemented as part
+of xenstore to act as an interface for access to the database for dom0 and
+guests. Two xenstored daemons are supported, one written in C which we refer
+to as the xenstored (sometimes referred to as cxenstored), and another written
+in Ocaml called oxenstored. Details for xenstore and the different
+implementations can be found on the wiki's xenstore reference guide [1] and
+the xenstored [2] page. You can choose which xenstore you want to enable as
+default on a system through configure:
+
+ ./configure --with-xenstored=xenstored
+ ./configure --with-xenstored=oxenstored
+
+By default oxenstored will be used if the ocaml development tools are found.
+If you enable oxenstored the xenstored will still be built and installed,
+the xenstored used can be changed through the configuration file:
+
+/etc/sysconfig/xencommons
+or
+/etc/default/xencommons
+
+You can change the preferred xenstored you want to use in the configuration
+but since we cannot stop the daemon a reboot will be required to make the
+change take effect.
+
+[0] http://wiki.xen.org/wiki/XenStore
+[1] http://wiki.xen.org/wiki/XenStoreReference
+[2] http://wiki.xen.org/wiki/Xenstored
+
Python Runtime Libraries
========================
--- /dev/null
+AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [
+ AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
+ AC_MSG_ERROR([Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib])
+ ])
+])
+
+AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [
+ xenstore="oxenstored"
+ xenstored=$SBINDIR/oxenstored
+ AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
+ xenstore="xenstored"
+ xenstored=$SBINDIR/xenstored
+ ])
+])
+
+AC_DEFUN([AX_XENSTORE_OPTIONS], [
+AS_IF([test "x$XENSTORE" = "x"], [
+AC_ARG_WITH([xenstored],
+ AS_HELP_STRING([--with-xenstored@<:@=oxenstored|xenstored@:>@],
+ [This lets you choose which xenstore daemon you want, you have
+ two options: the original xenstored written in C (xenstored)
+ or the newer and robust one written in Ocaml (oxenstored).
+ The oxenstored daemon is the default but will but can only
+ be used if you have ocaml library / build dependencies solved,
+ if you have not specified a preference and do not have ocaml
+ dependencies resolved we'll enable the C xenstored for you. If
+ you ask for oxenstored we'll complain until you resolve those
+ dependencies]),
+ [
+ AS_IF([test "x$withval" = "xxenstored"], [
+ xenstore=$withval
+ xenstored=$SBINDIR/xenstored
+ ])
+ AS_IF([test "x$withval" = "xoxenstored"], [
+ xenstore=$withval
+ xenstored=$SBINDIR/oxenstored
+ AX_XEN_OCAML_XENSTORE_CHECK()
+ ])
+ AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"], [
+ AC_MSG_ERROR([Unsupported xenstored specified, supported types: oxenstored xenstored])
+ ])
+ ],
+ [
+ AX_XEN_OCAML_XENSTORE_DEFAULTS()
+ ])
+])
+])
+
+AC_DEFUN([AX_XENSTORE_SET], [
+ XENSTORE=$xenstore
+
+ AS_IF([test "x$XENSTORED" = "x"], [
+ XENSTORED=$xenstored
+ ])
+ AC_SUBST(XENSTORED)
+])
PYTHONPATH
CHECKPOLICY
AWK
+XENSTORED
OCAMLFIND
OCAMLBUILD
OCAMLDOC
ocamltools
monitors
githttp
+XEN_PAGING_DIR
+XEN_LOCK_DIR
+XEN_SCRIPT_DIR
+XEN_CONFIG_DIR
+CONFIG_DIR
+XENFIRMWAREDIR
+PRIVATE_BINDIR
+PKG_XEN_PREFIX
+PRIVATE_PREFIX
+SHAREDIR
+XEN_LIB_STORED
+XEN_LOG_DIR
+XEN_RUN_DIR
+LIBDIR
+LIBEXEC
+SBINDIR
+BINDIR
FILE_OFFSET_BITS
OBJEXT
EXEEXT
with_system_seabios
with_system_ovmf
with_extra_qemuu_configure_args
+with_xenstored
'
ac_precious_vars='build_alias
host_alias
--with-extra-qemuu-configure-args[="--ARG1 ..."]
List of additional configure options for upstream
qemu
+ --with-xenstored[=oxenstored|xenstored]
+ This lets you choose which xenstore daemon you want,
+ you have two options: the original xenstored written
+ in C (xenstored) or the newer and robust one written
+ in Ocaml (oxenstored). The oxenstored daemon is the
+ default but will but can only be used if you have
+ ocaml library / build dependencies solved, if you
+ have not specified a preference and do not have
+ ocaml dependencies resolved we'll enable the C
+ xenstored for you. If you ask for oxenstored we'll
+ complain until you resolve those dependencies
Some influential environment variables:
CC C compiler command
-ac_config_files="$ac_config_files ../config/Tools.mk"
+ac_config_files="$ac_config_files ../config/Tools.mk hotplug/Linux/init.d/xencommons.in hotplug/Linux/init.d/sysconfig.xencommons"
ac_config_headers="$ac_config_headers config.h"
+
+
+
+
+
+
+
+
+
+
+
+test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
+test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix
+
+BINDIR=$prefix/bin
+
+
+SBINDIR=$prefix/sbin
+
+
+LIBEXEC=$prefix/lib/xen/bin
+
+
+LIBDIR=`eval echo $libdir`
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_LOG_DIR=/var/log/xen
+
+
+XEN_LIB_STORED=/var/lib/xenstored
+
+
+SHAREDIR=$prefix/share
+
+
+PRIVATE_PREFIX=$LIBDIR/xen
+
+
+PKG_XEN_PREFIX=$LIBDIR/xen
+
+
+PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+
+
+XENFIRMWAREDIR=$prefix/lib/xen/boot
+
+
+CONFIG_DIR=/etc
+
+
+XEN_CONFIG_DIR=$CONFIG_DIR/xen
+
+
+XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
+
+
+XEN_LOCK_DIR=/var/lock
+
+
+XEN_RUN_DIR=/var/run/xen
+
+
+XEN_PAGING_DIR=/var/lib/xen/xenpaging
+
+
+
# Enable/disable options
# Check whether --enable-githttp was given.
then
as_fn_error $? "Unable to find perl, please install perl" "$LINENO" 5
fi
-for ac_prog in gawk mawk nawk awk
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AWK"; then
- ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AWK="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$AWK" && break
-done
-
-if test "x$ocamltools" = "xy"; then :
- # checking for ocamlc
+ # checking for ocamlc
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ocamlc", so it can be a program name with args.
set dummy ${ac_tool_prefix}ocamlc; ac_word=$2
+
+
+if test "x$XENSTORE" = "x"; then :
+
+
+# Check whether --with-xenstored was given.
+if test "${with_xenstored+set}" = set; then :
+ withval=$with_xenstored;
+ if test "x$withval" = "xxenstored"; then :
+
+ xenstore=$withval
+ xenstored=$SBINDIR/xenstored
+
+fi
+ if test "x$withval" = "xoxenstored"; then :
+
+ xenstore=$withval
+ xenstored=$SBINDIR/oxenstored
+
+ if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
+
+ as_fn_error $? "Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib" "$LINENO" 5
+
+fi
+
+
+fi
+ if test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"; then :
+
+ as_fn_error $? "Unsupported xenstored specified, supported types: oxenstored xenstored" "$LINENO" 5
+
+fi
+
+else
+
+
+ xenstore="oxenstored"
+ xenstored=$SBINDIR/oxenstored
+ if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
+
+ xenstore="xenstored"
+ xenstored=$SBINDIR/xenstored
+
+fi
+
+
+fi
+
+
+fi
+
+
+ XENSTORE=$xenstore
+
+ if test "x$XENSTORED" = "x"; then :
+
+ XENSTORED=$xenstored
+
+fi
+
+
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+if test "x$ocamltools" = "xy"; then :
+
if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
if test "x$enable_ocamltools" = "xyes"; then :
do
case $ac_config_target in
"../config/Tools.mk") CONFIG_FILES="$CONFIG_FILES ../config/Tools.mk" ;;
+ "hotplug/Linux/init.d/xencommons.in") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/xencommons.in" ;;
+ "hotplug/Linux/init.d/sysconfig.xencommons") CONFIG_FILES="$CONFIG_FILES hotplug/Linux/init.d/sysconfig.xencommons" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
[xen-devel@lists.xen.org], [xen], [http://www.xen.org/])
AC_CONFIG_SRCDIR([libxl/libxl.c])
-AC_CONFIG_FILES([../config/Tools.mk])
+AC_CONFIG_FILES([
+../config/Tools.mk
+hotplug/Linux/init.d/xencommons.in
+hotplug/Linux/init.d/sysconfig.xencommons
+])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([../])
m4_include([../m4/extfs.m4])
m4_include([../m4/fetcher.m4])
m4_include([../m4/ax_compare_version.m4])
+m4_include([../m4/paths.m4])
+m4_include([../m4/xenstored.m4])
+
+AX_XEN_EXPAND_CONFIG()
# Enable/disable options
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
AC_PATH_PROG([BISON], [bison])
AC_PATH_PROG([FLEX], [flex])
AX_PATH_PROG_OR_FAIL([PERL], [perl])
+
+AC_PROG_OCAML
+AC_PROG_FINDLIB
+
+AX_XENSTORE_OPTIONS
+AX_XENSTORE_SET
+
AS_IF([test "x$ocamltools" = "xy"], [
- AC_PROG_OCAML
- AC_PROG_FINDLIB
AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
AS_IF([test "x$enable_ocamltools" = "xyes"], [
AC_MSG_ERROR([Ocaml tools enabled, but unable to find Ocaml])])
+++ /dev/null
-## Path: System/Virtualization
-## Type: string
-## Default: "none"
-#
-# Log xenconsoled messages (cf xl dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-## Type: string
-## Default: xenstored
-#
-# Select xenstored implementation
-#XENSTORED=[oxenstored|xenstored]
-
-## Type: string
-## Default: Not defined, tracing off
-#
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-## Type: string
-## Default: "/var/lib/xenstored"
-#
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-## Type: string
-## Default: Not defined, xenbackendd debug mode off
-#
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]
-
-# qemu path
-#QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386
--- /dev/null
+## Path: System/Virtualization
+## Type: string
+## Default: "none"
+#
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+## 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.
+#
+# This can be either of:
+# * @SBINDIR@/oxenstored
+# * @SBINDIR@/xenstored
+#
+# Changing this requires a reboot to take effect.
+#XENSTORED=@XENSTORED@
+
+## Type: string
+## Default: Not defined, tracing off
+#
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+## Type: string
+## Default: "/var/lib/xenstored"
+#
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+## Type: string
+## Default: Not defined, xenbackendd debug mode off
+#
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]
+
+# qemu path
+#QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386
+++ /dev/null
-#!/bin/bash
-#
-# xencommons Script to start and stop xenstored and xenconsoled
-#
-# Author: Ian Jackson <ian.jackson@eu.citrix.com>
-#
-# chkconfig: 2345 70 10
-# description: Starts and stops xenstored and xenconsoled
-### BEGIN INIT INFO
-# Provides: xenstored xenconsoled
-# Required-Start: $syslog $remote_fs
-# Should-Start:
-# Required-Stop: $syslog $remote_fs
-# Should-Stop:
-# Default-Start: 2 3 5
-# Default-Stop: 0 1 6
-# Short-Description: Start/stop xenstored and xenconsoled
-# Description: Starts and stops the daemons neeeded for xl/xend
-### END INIT INFO
-
-. /etc/xen/scripts/hotplugpath.sh
-
-if [ -d /etc/sysconfig ]; then
- xencommons_config=/etc/sysconfig
-else
- xencommons_config=/etc/default
-fi
-
-test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
-
-XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
-QEMU_PIDFILE=/var/run/qemu-dom0.pid
-shopt -s extglob
-
-# not running in Xen dom0 or domU
-if ! test -d /proc/xen ; then
- exit 0
-fi
-
-# mount xenfs in dom0 or domU with a pv_ops kernel
-if test "x$1" = xstart && \
- ! test -f /proc/xen/capabilities && \
- ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
- mount -t xenfs xenfs /proc/xen
-fi
-
-# run this script only in dom0:
-# no capabilities file in xenlinux domU kernel
-# empty capabilities file in pv_ops domU kernel
-if test -f /proc/xen/capabilities && \
- ! grep -q "control_d" /proc/xen/capabilities ; then
- exit 0
-fi
-
-do_start () {
- local time=0
- local timeout=30
-
- @LOAD_MODULES@
- mkdir -p /var/run/xen
-
- if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
- then
- test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored"
- 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
- elif [ -x ${SBINDIR}/oxenstored ] ; then
- echo -n Starting oxenstored...
- ${SBINDIR}/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
- elif [ -x ${SBINDIR}/xenstored ] ; then
- echo -n Starting C xenstored...
- ${SBINDIR}/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
- echo Could not start xenstored
- exit 1
- fi
-
- echo Setting domain 0 name and domid...
- ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
- ${BINDIR}/xenstore-write "/local/domain/0/domid" 0
- fi
-
- echo Starting xenconsoled...
- test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
- ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
- echo Starting QEMU as disk backend for dom0
- test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC}/qemu-system-i386"
- $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
- -monitor /dev/null -serial /dev/null -parallel /dev/null \
- -pidfile $QEMU_PIDFILE
-}
-do_stop () {
- echo Stopping xenconsoled
- if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
- kill $pid
- while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
- rm -f $XENCONSOLED_PIDFILE
- fi
-
- echo Stopping QEMU
- if read 2>/dev/null <$QEMU_PIDFILE pid; then
- kill $pid
- while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
- rm -f $QEMU_PIDFILE
- fi
-
- echo WARNING: Not stopping xenstored, as it cannot be restarted.
-}
-
-case "$1" in
- start)
- do_start
- ;;
- status)
- ${BINDIR}/xenstore-read -s /
- ;;
- stop)
- do_stop
- ;;
- reload)
- echo >&2 'Reload not available; use force-reload'; exit 1
- ;;
- force-reload|restart)
- do_stop
- do_start
- ;;
- *)
- # do not advertise unreasonable commands that there is no reason
- # to use with this device
- echo $"Usage: $0 {start|stop|status|restart|force-reload}"
- exit 1
-esac
-
-exit $?
--- /dev/null
+#!/bin/bash
+#
+# xencommons Script to start and stop xenstored and xenconsoled
+#
+# Author: Ian Jackson <ian.jackson@eu.citrix.com>
+#
+# chkconfig: 2345 70 10
+# description: Starts and stops xenstored and xenconsoled
+### BEGIN INIT INFO
+# Provides: xenstored xenconsoled
+# Required-Start: $syslog $remote_fs
+# Should-Start:
+# Required-Stop: $syslog $remote_fs
+# Should-Stop:
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start/stop xenstored and xenconsoled
+# Description: Starts and stops the daemons neeeded for xl/xend
+### END INIT INFO
+
+XENSTORED=@XENSTORED@
+
+. /etc/xen/scripts/hotplugpath.sh
+
+if [ -d /etc/sysconfig ]; then
+ xencommons_config=/etc/sysconfig
+else
+ xencommons_config=/etc/default
+fi
+
+test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
+
+XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+QEMU_PIDFILE=/var/run/qemu-dom0.pid
+shopt -s extglob
+
+# not running in Xen dom0 or domU
+if ! test -d /proc/xen ; then
+ exit 0
+fi
+
+# mount xenfs in dom0 or domU with a pv_ops kernel
+if test "x$1" = xstart && \
+ ! test -f /proc/xen/capabilities && \
+ ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+ mount -t xenfs xenfs /proc/xen
+fi
+
+# run this script only in dom0:
+# no capabilities file in xenlinux domU kernel
+# empty capabilities file in pv_ops domU kernel
+if test -f /proc/xen/capabilities && \
+ ! grep -q "control_d" /proc/xen/capabilities ; then
+ exit 0
+fi
+
+do_start () {
+ local time=0
+ local timeout=30
+
+ @LOAD_MODULES@
+ mkdir -p /var/run/xen
+
+ if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
+ then
+ test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored"
+ 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
+ echo Could not start xenstored
+ exit 1
+ fi
+
+ echo Setting domain 0 name and domid...
+ ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
+ ${BINDIR}/xenstore-write "/local/domain/0/domid" 0
+ fi
+
+ echo Starting xenconsoled...
+ test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
+ ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
+ echo Starting QEMU as disk backend for dom0
+ test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC}/qemu-system-i386"
+ $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
+ -monitor /dev/null -serial /dev/null -parallel /dev/null \
+ -pidfile $QEMU_PIDFILE
+}
+do_stop () {
+ echo Stopping xenconsoled
+ if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
+ kill $pid
+ while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+ rm -f $XENCONSOLED_PIDFILE
+ fi
+
+ echo Stopping QEMU
+ if read 2>/dev/null <$QEMU_PIDFILE pid; then
+ kill $pid
+ while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+ rm -f $QEMU_PIDFILE
+ fi
+
+ echo WARNING: Not stopping xenstored, as it cannot be restarted.
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ status)
+ ${BINDIR}/xenstore-read -s /
+ ;;
+ stop)
+ do_stop
+ ;;
+ reload)
+ echo >&2 'Reload not available; use force-reload'; exit 1
+ ;;
+ force-reload|restart)
+ do_stop
+ do_start
+ ;;
+ *)
+ # do not advertise unreasonable commands that there is no reason
+ # to use with this device
+ echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+ exit 1
+esac
+
+exit $?