Mailinglist Archive: vhostmd (42 mails)
| < Previous | Next > |
[vhostmd] [PATCH] Allow xenstore dependency to be removed
- From: "Richard W.M. Jones" <rjones@xxxxxxxxxx>
- Date: Mon, 12 Oct 2009 17:30:22 +0100
- Message-id: <20091012163022.GD17519@xxxxxxxxxxxxxxxxxxxx>
This patch lets you compile vhostmd without xenstore support in
the main daemon. Our use-case is for platforms where Xen isn't
available.
The default is the same as currently - ie. xenstore is compiled in.
To disable xenstore, the packager would compile with:
./configure --without-xenstore
(this also disables xenstore in the domU tool as before).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Date: Mon, 12 Oct 2009 17:27:01 +0100
Subject: [PATCH] Allow xenstore dependency to be removed using ./configure
--without-xenstore.
If ./configure --without-xenstore, then the dependency on
xenstore is removed. Attempts to use xenstore will result
in a runtime error.
The default is still that xenstore is enabled.
---
configure.ac | 9 ++++-----
include/metric.h | 2 ++
vhostmd/Makefile.am | 7 ++++++-
vhostmd/vhostmd.c | 10 +++++++++-
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8cd4350..285e2c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,15 +69,14 @@ if test "x$xenctrl" = "xfalse"; then
AM_CONDITIONAL(LIBVIRT, test x$libvirt = xtrue)
fi
-# Configure argument to support using xenstore in domU utility
+# Configure argument to support using xenstore
AC_ARG_WITH([xenstore],
- [ --with-xenstore use xenstore in domU utility ],
+ [ --without-xenstore disable use of xenstore],
[case "${withval}" in
- yes) with_xenstore=true
- ;;
+ yes) with_xenstore=true;;
no) with_xenstore=false;;
*) AC_MSG_ERROR(bad value ${withval} for --with-xenstore) ;;
- esac],[with_xenstore=false])
+ esac],[with_xenstore=true])
AM_CONDITIONAL(WITH_XENSTORE, test x$with_xenstore = xtrue)
AC_OUTPUT(vhostmd/Makefile
diff --git a/include/metric.h b/include/metric.h
index 338249c..6c8432e 100644
--- a/include/metric.h
+++ b/include/metric.h
@@ -75,6 +75,8 @@ int metric_xml(metric *m, vu_buffer *buf);
int xen_metrics(metric **user_metrics);
#endif
+#ifdef WITH_XENSTORE
int metrics_xenstore_update(char *buffer, int *ids, int num_vms);
+#endif
#endif /* __METRIC_H__ */
diff --git a/vhostmd/Makefile.am b/vhostmd/Makefile.am
index e1d79bc..3801882 100644
--- a/vhostmd/Makefile.am
+++ b/vhostmd/Makefile.am
@@ -3,10 +3,15 @@ INCLUDES = \
-I../include
sbin_PROGRAMS = vhostmd
-vhostmd_SOURCES = vhostmd.c util.c metric.c xenstore-update.c
+vhostmd_SOURCES = vhostmd.c util.c metric.c
vhostmd_CFLAGS = $(LIBXML_CFLAGS)
vhostmd_LDADD = -lm $(LIBXML_LIBS)
+if WITH_XENSTORE
+vhostmd_SOURCES += xenstore-update.c
+vhostmd_LDADD += -lxenstore
+endif
+
if XENCTRL
vhostmd_SOURCES += xenctrl-util.c
vhostmd_LDADD += -lxenctrl -lxenstore
diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
index a5331ad..9e43070 100644
--- a/vhostmd/vhostmd.c
+++ b/vhostmd/vhostmd.c
@@ -451,8 +451,14 @@ static int parse_transports(xmlDocPtr xml,
if (str) {
if (strncasecmp((char *)str, "vbd", strlen("vbd")) == 0)
transports |= VBD;
- if (strncasecmp((char *)str, "xenstore", strlen("xenstore")) == 0)
+ if (strncasecmp((char *)str, "xenstore", strlen("xenstore")) == 0) {
+#ifdef WITH_XENSTORE
transports |= XENSTORE;
+#else
+ vu_log (VHOSTMD_ERR, "No support for xenstore transport in this
vhostmd");
+ return -1;
+#endif
+ }
free(str);
}
}
@@ -910,8 +916,10 @@ static int vhostmd_run(int diskfd)
vu_buffer_add(buf, "</metrics>\n", -1);
if (transports & VBD)
metrics_disk_update(diskfd, buf);
+#ifdef WITH_XENSTORE
if (transports & XENSTORE)
metrics_xenstore_update(buf->content, ids, num_vms);
+#endif
if (ids)
free(ids);
sleep(update_period);
--
1.6.2.5
the main daemon. Our use-case is for platforms where Xen isn't
available.
The default is the same as currently - ie. xenstore is compiled in.
To disable xenstore, the packager would compile with:
./configure --without-xenstore
(this also disables xenstore in the domU tool as before).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
From 326f00121729760c0236ef1b56b905f85470c740 Mon Sep 17 00:00:00 2001From: Richard Jones <rjones@xxxxxxxxxx>
Date: Mon, 12 Oct 2009 17:27:01 +0100
Subject: [PATCH] Allow xenstore dependency to be removed using ./configure
--without-xenstore.
If ./configure --without-xenstore, then the dependency on
xenstore is removed. Attempts to use xenstore will result
in a runtime error.
The default is still that xenstore is enabled.
---
configure.ac | 9 ++++-----
include/metric.h | 2 ++
vhostmd/Makefile.am | 7 ++++++-
vhostmd/vhostmd.c | 10 +++++++++-
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8cd4350..285e2c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,15 +69,14 @@ if test "x$xenctrl" = "xfalse"; then
AM_CONDITIONAL(LIBVIRT, test x$libvirt = xtrue)
fi
-# Configure argument to support using xenstore in domU utility
+# Configure argument to support using xenstore
AC_ARG_WITH([xenstore],
- [ --with-xenstore use xenstore in domU utility ],
+ [ --without-xenstore disable use of xenstore],
[case "${withval}" in
- yes) with_xenstore=true
- ;;
+ yes) with_xenstore=true;;
no) with_xenstore=false;;
*) AC_MSG_ERROR(bad value ${withval} for --with-xenstore) ;;
- esac],[with_xenstore=false])
+ esac],[with_xenstore=true])
AM_CONDITIONAL(WITH_XENSTORE, test x$with_xenstore = xtrue)
AC_OUTPUT(vhostmd/Makefile
diff --git a/include/metric.h b/include/metric.h
index 338249c..6c8432e 100644
--- a/include/metric.h
+++ b/include/metric.h
@@ -75,6 +75,8 @@ int metric_xml(metric *m, vu_buffer *buf);
int xen_metrics(metric **user_metrics);
#endif
+#ifdef WITH_XENSTORE
int metrics_xenstore_update(char *buffer, int *ids, int num_vms);
+#endif
#endif /* __METRIC_H__ */
diff --git a/vhostmd/Makefile.am b/vhostmd/Makefile.am
index e1d79bc..3801882 100644
--- a/vhostmd/Makefile.am
+++ b/vhostmd/Makefile.am
@@ -3,10 +3,15 @@ INCLUDES = \
-I../include
sbin_PROGRAMS = vhostmd
-vhostmd_SOURCES = vhostmd.c util.c metric.c xenstore-update.c
+vhostmd_SOURCES = vhostmd.c util.c metric.c
vhostmd_CFLAGS = $(LIBXML_CFLAGS)
vhostmd_LDADD = -lm $(LIBXML_LIBS)
+if WITH_XENSTORE
+vhostmd_SOURCES += xenstore-update.c
+vhostmd_LDADD += -lxenstore
+endif
+
if XENCTRL
vhostmd_SOURCES += xenctrl-util.c
vhostmd_LDADD += -lxenctrl -lxenstore
diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
index a5331ad..9e43070 100644
--- a/vhostmd/vhostmd.c
+++ b/vhostmd/vhostmd.c
@@ -451,8 +451,14 @@ static int parse_transports(xmlDocPtr xml,
if (str) {
if (strncasecmp((char *)str, "vbd", strlen("vbd")) == 0)
transports |= VBD;
- if (strncasecmp((char *)str, "xenstore", strlen("xenstore")) == 0)
+ if (strncasecmp((char *)str, "xenstore", strlen("xenstore")) == 0) {
+#ifdef WITH_XENSTORE
transports |= XENSTORE;
+#else
+ vu_log (VHOSTMD_ERR, "No support for xenstore transport in this
vhostmd");
+ return -1;
+#endif
+ }
free(str);
}
}
@@ -910,8 +916,10 @@ static int vhostmd_run(int diskfd)
vu_buffer_add(buf, "</metrics>\n", -1);
if (transports & VBD)
metrics_disk_update(diskfd, buf);
+#ifdef WITH_XENSTORE
if (transports & XENSTORE)
metrics_xenstore_update(buf->content, ids, num_vms);
+#endif
if (ids)
free(ids);
sleep(update_period);
--
1.6.2.5
| < Previous | Next > |