diff --git a/README b/README index 0c8c7aacb9..7c27fbbf40 100644 --- a/README +++ b/README @@ -129,6 +129,38 @@ performed with root privileges.] 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 ======================== diff --git a/m4/xenstored.m4 b/m4/xenstored.m4 new file mode 100644 index 0000000000..30b44c9757 --- /dev/null +++ b/m4/xenstored.m4 @@ -0,0 +1,56 @@ +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) +]) diff --git a/tools/configure b/tools/configure index a4aa8f1855..08d6a055e5 100755 --- a/tools/configure +++ b/tools/configure @@ -649,6 +649,7 @@ pyconfig PYTHONPATH CHECKPOLICY AWK +XENSTORED OCAMLFIND OCAMLBUILD OCAMLDOC @@ -698,6 +699,23 @@ xsmpolicy 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 @@ -772,6 +790,7 @@ with_system_qemu with_system_seabios with_system_ovmf with_extra_qemuu_configure_args +with_xenstored ' ac_precious_vars='build_alias host_alias @@ -1451,6 +1470,17 @@ Optional Packages: --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 @@ -2205,7 +2235,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -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" @@ -3587,6 +3617,75 @@ esac + + + + + + + + + + + +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. @@ -4757,51 +4856,8 @@ if test x"${PERL}" = x"no" 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 @@ -5895,6 +5951,112 @@ fi + + +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 : @@ -8864,6 +9026,8 @@ for ac_config_target in $ac_config_targets 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;; diff --git a/tools/configure.ac b/tools/configure.ac index 629d6a044a..e74fe4b135 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -5,7 +5,11 @@ AC_PREREQ([2.67]) 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([../]) @@ -53,6 +57,10 @@ m4_include([../m4/ptyfuncs.m4]) 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]) @@ -203,9 +211,14 @@ AC_PROG_INSTALL 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])]) diff --git a/tools/hotplug/Linux/init.d/sysconfig.xencommons b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in similarity index 63% rename from tools/hotplug/Linux/init.d/sysconfig.xencommons rename to tools/hotplug/Linux/init.d/sysconfig.xencommons.in index 25f7f00d23..d423ff8b99 100644 --- a/tools/hotplug/Linux/init.d/sysconfig.xencommons +++ b/tools/hotplug/Linux/init.d/sysconfig.xencommons.in @@ -8,8 +8,17 @@ ## Type: string ## Default: xenstored # -# Select xenstored implementation -#XENSTORED=[oxenstored|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 diff --git a/tools/hotplug/Linux/init.d/xencommons.in b/tools/hotplug/Linux/init.d/xencommons.in.in similarity index 92% rename from tools/hotplug/Linux/init.d/xencommons.in rename to tools/hotplug/Linux/init.d/xencommons.in.in index 3939bcca07..b311bb8192 100644 --- a/tools/hotplug/Linux/init.d/xencommons.in +++ b/tools/hotplug/Linux/init.d/xencommons.in.in @@ -18,6 +18,8 @@ # 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 @@ -69,12 +71,6 @@ do_start () { 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