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

[Xen-devel] [PATCH v5 12/14] 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=cxenstored
./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 we can move it to the shared top level config and use
this to simplify both the legacy init script and eventually our systemd
service files. This should also make it clear on how you can still
enable usage of cxenstored but still also use ocaml tools. If you have
both oxenstored and cxenstored installed you can change the xenstore by
a simple flip on the system configuration file.

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.

[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 ./autgen.sh after this patch is applied.

 README                                | 34 +++++++++++++++++++
 config/Toplevel.mk.in                 |  3 ++
 config/xen-environment-header.in      |  3 ++
 config/xen-environment-scripts.in     |  3 ++
 configure.ac                          |  1 +
 m4/expand_config.m4                   | 61 +++++++++++++++++++++++++++++++++++
 stubdom/configure.ac                  |  1 +
 tools/hotplug/Linux/init.d/xencommons |  6 ----
 8 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 079e6a9..4183b34 100644
--- a/README
+++ b/README
@@ -145,6 +145,40 @@ Further documentation can be found on the wiki:
 
 
http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
 
+xenstored: cxenstored and oxenstored
+====================================
+
+Xen uses a xenstore [0] to upkeep configuration and status information shared
+between domains. A daemon is provided to help respond to queries from dom0
+and guests, details for the xenstored can be found on the wiki's xenstored [2]
+page. Two xenstored daemons are supported and you can choose which xenstored
+you want to enable on a system through configure:
+
+       ./configure --with-xenstored=cxenstored
+       ./configure --with-xenstored=oxenstored
+
+By defalut oxenstored will be used if the ocaml development tools are found.
+If you enable oxenstored the cxenstored will still be built and installed,
+the xenstored used can be changed through the configuration file:
+
+/etc/xen/scripts/hotplugpath.sh
+
+This file has two relevant variables which are specific to the version of
+xenstored used:
+
+       * XENSTORED - specifies the full path of the xenstored binary
+       * XENSTORE - specifies the name 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. The original /etc/xen/scripts/hotplugpath.sh is sourced
+from the general xen system configuration file documented above, which is
+generated at build time after running ./configure.
+
+[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/config/Toplevel.mk.in b/config/Toplevel.mk.in
index fc2754c..bea9d96 100644
--- a/config/Toplevel.mk.in
+++ b/config/Toplevel.mk.in
@@ -23,3 +23,6 @@ XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
 XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
+
+XENSTORED                := @XENSTORED@
+XENSTORE                 := @XENSTORE@
diff --git a/config/xen-environment-header.in b/config/xen-environment-header.in
index 7dd7a53..3ee8e32 100644
--- a/config/xen-environment-header.in
+++ b/config/xen-environment-header.in
@@ -11,3 +11,6 @@
 #define XEN_LOCK_DIR "@XEN_LOCK_DIR@"
 #define XEN_RUN_DIR "@XEN_RUN_DIR@"
 #define XEN_PAGING_DIR "@XEN_PAGING_DIR@"
+
+#define XENSTORED @XENSTORED@
+#define XENSTORE @XENSTORE@
diff --git a/config/xen-environment-scripts.in 
b/config/xen-environment-scripts.in
index 9623231..a17e0e9 100644
--- a/config/xen-environment-scripts.in
+++ b/config/xen-environment-scripts.in
@@ -13,3 +13,6 @@ XEN_LOG_DIR="@XEN_LOG_DIR@"
 XEN_LIB_STORED="@XEN_LIB_STORED@"
 XEN_RUN_DIR="@XEN_RUN_DIR@"
 XEN_PAGING_DIR="@XEN_PAGING_DIR@"
+
+XENSTORED="@XENSTORED@"
+XENSTORE="@XENSTORE@"
diff --git a/configure.ac b/configure.ac
index 3f26a39..f5faa4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,7 @@ AC_CANONICAL_HOST
 m4_include([m4/features.m4])
 m4_include([m4/subsystem.m4])
 m4_include([m4/expand_config.m4])
+m4_include([m4/ocaml.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
diff --git a/m4/expand_config.m4 b/m4/expand_config.m4
index 717fcd1..40d9707 100644
--- a/m4/expand_config.m4
+++ b/m4/expand_config.m4
@@ -58,4 +58,65 @@ AC_SUBST(XEN_RUN_DIR)
 
 XEN_PAGING_DIR=/var/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
+
+AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [
+       AC_PROG_OCAML
+       AC_PROG_FINDLIB
+       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
+       AC_PROG_OCAML
+       AC_PROG_FINDLIB
+       AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
+               xenstore="cxenstored"
+               xenstored=$SBINDIR/xenstored
+       ])
+])
+
+AS_IF([test "x$XENSTORE" = "x"], [
+AC_ARG_WITH([xenstored],
+       AS_HELP_STRING([--with-xenstored@<:@=cxenstored|cxenstored@:>@],
+               [This lets you choose which xenstore daemon you want, you have
+               two options: the original xenstored written in C (cxenstored)
+               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" = "xcxenstored"], [
+                       xenstore="cxenstored"
+                       xenstored=$SBINDIR/xenstored
+               ])
+               AS_IF([test "x$withval" = "xoxenstored"], [
+                       xenstore="oxenstored"
+                       xenstored=$SBINDIR/oxenstored
+                       AX_XEN_OCAML_XENSTORE_CHECK()
+               ])
+               AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != 
"xcxenstored"], [
+                       AC_MSG_ERROR([Unsupported xenstored specified, 
supported types: oxenstored cxenstored])
+               ])
+       ],
+       [
+               AX_XEN_OCAML_XENSTORE_DEFAULTS()
+       ])
+])
+
+XENSTORE=$xenstore
+AC_SUBST(XENSTORE)
+
+AS_IF([test "x$XENSTORED" = "x"], [
+       XENSTORED=$xenstored
+])
+AC_SUBST(XENSTORED)
+
+AS_IF([test "x$XENSTORE" != "xcxenstored" && test "x$XENSTORE" != 
"xoxenstored"],
+       [AC_MSG_ERROR([Invalid xenstore: $XENSTORE])])
 ])
diff --git a/stubdom/configure.ac b/stubdom/configure.ac
index d6b0fbf..3c30004 100644
--- a/stubdom/configure.ac
+++ b/stubdom/configure.ac
@@ -17,6 +17,7 @@ m4_include([../m4/path_or_fail.m4])
 m4_include([../m4/depends.m4])
 m4_include([../m4/fetcher.m4])
 m4_include([../m4/expand_config.m4])
+m4_include([../m4/ocaml.m4])
 
 AX_XEN_EXPAND_CONFIG()
 
diff --git a/tools/hotplug/Linux/init.d/xencommons 
b/tools/hotplug/Linux/init.d/xencommons
index 4ebd636..2bb6f26 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons
@@ -83,12 +83,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.0.rc3.18.g00a5b79


_______________________________________________
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®.