Mailinglist Archive: vhostmd (2 mails)

< Previous Next >
[vhostmd] [PATCH] Fix build when './configure --enable-xenctrl' is used
  • From: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
  • Date: Thu, 7 Jan 2010 14:34:19 +0000
  • Message-id: <4B45F0EB.6090202@xxxxxxxxxxxxx>
Hi all,

The attached patch against v0.4 fixes the build when --enable-xenctrl is used.

If this configure option is used vhostmd does not link against libvirt or virt-util.o, but a few bits of code were assuming that these were always linked in.

Please could you consider this patch for inclusion in the vhostmd project.

Regards,

Alex Zeffertt
Fix build when "./configure --enable-xenctrl" is used.

This option disables the use of libvirt. Instead libxc gets used to
find out stuff about VMs.

If this option is used then virt-util.c does not get built. This
patch removes the linker dependencies on virt-util.o when
--enable-xenctrl is used.

Signed-off-by: <alex.zeffertt@xxxxxxxxxxxxx>

diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2009-12-09 09:41:52.000000000 -0500
+++ b/configure.ac 2010-01-07 06:18:44.000000000 -0500
@@ -55,7 +55,8 @@
AC_ARG_ENABLE([xenctrl],
[ --enable-xenctrl use xenctrl specific vm enumeration instead of
libvirt],
[case "${enableval}" in
- yes) xenctrl=true
+ yes) xenctrl=true
+ CFLAGS="$CFLAGS -DXENCTRL"
;;
no) xenctrl=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-xenctrl) ;;
diff -urN a/include/util.h b/include/util.h
--- a/include/util.h 2009-12-09 09:41:52.000000000 -0500
+++ b/include/util.h 2010-01-07 06:25:53.000000000 -0500
@@ -47,10 +47,13 @@
char *uuid;
} vu_vm;

+
+#ifndef XENCTRL
/* The libvirt URI to connect to (-c argument on the command line). If
* not set, this will be NULL.
*/
extern const char *libvirt_uri;
+#endif

/*
* Init logging interface. If running as daemon messages
diff -urN a/vhostmd/metric.c b/vhostmd/metric.c
--- a/vhostmd/metric.c 2009-12-09 09:41:52.000000000 -0500
+++ b/vhostmd/metric.c 2010-01-07 06:25:16.000000000 -0500
@@ -71,6 +71,10 @@
return -1;
}

+#ifdef XENCTRL
+ temp = replace (temp, "CONNECT", "");
+ if (temp == NULL) return -1;
+#else /* LIBVIRT used instead */
if (libvirt_uri) {
temp = replace (temp, "CONNECT", "--connect '%s'", libvirt_uri);
if (temp == NULL) return -1;
@@ -78,6 +82,7 @@
temp = replace (temp, "CONNECT", "");
if (temp == NULL) return -1;
}
+#endif

if (m->ctx == METRIC_CONTEXT_VM) {
temp = replace (temp, "NAME", "%s", m->vm->name);
diff -urN a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c
--- a/vhostmd/vhostmd.c 2009-12-09 09:41:52.000000000 -0500
+++ b/vhostmd/vhostmd.c 2010-01-07 06:24:16.000000000 -0500
@@ -976,7 +976,9 @@
{ "config", required_argument, NULL, 'f'},
{ "pid-file", required_argument, NULL, 'p'},
{ "user", required_argument, NULL, 'u'},
+#ifndef XENCTRL
{ "connect", required_argument, NULL, 'c'},
+#endif
{ "help", no_argument, NULL, '?' },
{0, 0, 0, 0}
};
@@ -1009,9 +1011,11 @@
case 'u':
user = optarg;
break;
+#ifndef XENCTRL
case 'c':
libvirt_uri = optarg;
break;
+#endif
case '?':
usage(argv[0]);
return 2;
< Previous Next >
List Navigation
Follow Ups