[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v7 7/8] autoconf: xen: enable explicit preference option for xenstored preference



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

As it stands oxenstored will be used by default if ocaml tools are
found, the init system will also try to use oxenstored first if its
found otherwise the cxenstored will be used. Lets simplify the init
script and let users be explicit about the preference through configure.

This adds support to let you be explicit about the xenstored preference,
you can only use one of these two options:

./configure --with-xenstored=xenstored
./configure --with-xenstored=oxenstored

We continue with the old behaviour and default oxenstored will be used
but only if you have ocaml dependencies. Since the xenstored preference
is explicit now and since we require configure substitutions for it we
make use of the AX_XEN_EXPAND_CONFIG() helpers as otherwise substitution
for SBINDIR is not propagated from the top level configuration.

All this allows us to simplify the init script to use the configured
xenstore from the start. We update the sysconfig/default xencommons file
with the paths for the different options though, this can be used by
users to override the default xenstored, this follows the old behaviour
but we now just explicitly provide the full configured paths for users.

As before, changing the xenstore requires a reboot.

In order to help with documentation we update the README with some
details on configure usage refer to the wiki [0] [1] [2] for more elaborate
details.

Since we are now parsing an entry within Paths.mk.in on tools we let
the move the parsing of the file to be the tool's configure.

[0] http://wiki.xen.org/wiki/Xenstored
[1] http://wiki.xen.org/wiki/XenStore
[2] http://wiki.xen.org/wiki/XenStoreReference

Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Keir Fraser <keir@xxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---

Please run autogen.sh after merging this patch.

 README                                             | 37 ++++++++++++++
 m4/xenstored.m4                                    | 56 ++++++++++++++++++++++
 tools/configure.ac                                 | 19 ++++++--
 ...ysconfig.xencommons => sysconfig.xencommons.in} | 13 ++++-
 .../init.d/{xencommons.in => xencommons.in.in}     |  8 +---
 5 files changed, 122 insertions(+), 11 deletions(-)
 create mode 100644 m4/xenstored.m4
 rename tools/hotplug/Linux/init.d/{sysconfig.xencommons => 
sysconfig.xencommons.in} (63%)
 rename tools/hotplug/Linux/init.d/{xencommons.in => xencommons.in.in} (92%)

diff --git a/README b/README
index c6cc09b..0a19eb6 100644
--- a/README
+++ b/README
@@ -129,6 +129,43 @@ 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
+
+This file has one relevant variables which is specific to the version of
+xenstored used:
+
+       * XENSTORED - specifies the full path of the xenstored binary
+
+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 0000000..30b44c9
--- /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.ac b/tools/configure.ac
index 629d6a0..e74fe4b 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@xxxxxxxxxxxxx], [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 25f7f00..d423ff8 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 3939bcc..b311bb8 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
-- 
2.0.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.