[libvirt] [PATCH RFC] libxl: fix paths in capability string

Wei Liu wei.liu2 at citrix.com
Tue Jan 6 16:12:18 UTC 2015

Currently libxl driver hardcodes some paths in its capability string,
which might not be the correct paths.

This patch introduces --with-libxl-prefix, so that user can specify the
prefix used to build Xen tools. The default value is /usr/local which is
the default --prefix for Xen tools.

Change emualtor from qemu-dm to qemu-system-i386 because libxl (in Xen)
use this as the default emulator.

No need to check hostarch to determine whether to use lib or lib64
anymore because we now always use lib.

Signed-off-by: Wei Liu <wei.liu2 at citrix.com>
This patch is RFC because I introduce --with-libxl-prefix and I don't know
whether it's acceptable.

Right now libvirt's driver doesn't seem to use these default paths so
everything just works. But it would be nice for libvirt to report the
correct paths instead of hardcoded (and possibly wrong) ones.
 configure.ac           |    4 ++++
 src/libxl/libxl_conf.c |    6 ++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 167b875..8d10361 100644
--- a/configure.ac
+++ b/configure.ac
@@ -533,6 +533,9 @@ AC_ARG_WITH([libxl],
     [add libxenlight support @<:@default=check@:>@])])
 m4_divert_text([DEFAULTS], [with_libxl=check])
+AC_ARG_WITH([libxl-prefix], [AS_HELP_STRING([--with-libxl-prefix=path],
+            [prefix used to build libxl, default /usr/local])],
+            [LIBXL_PREFIX=$withval], [LIBXL_PREFIX="/usr/local"])
     [VirtualBox XPCOMC location @<:@default=yes@:>@])])
@@ -893,6 +896,7 @@ fi
 if test "$with_libxl" = "yes"; then
     AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled])
 AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"])
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 0555b91..fbb4e29 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -428,11 +428,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
         if ((guest = virCapabilitiesAddGuest(caps,
                                              guest_archs[i].hvm ? "hvm" : "xen",
-                                             ((hostarch == VIR_ARCH_X86_64) ?
-                                              "/usr/lib64/xen/bin/qemu-dm" :
-                                              "/usr/lib/xen/bin/qemu-dm"),
+                                             LIBXL_PREFIX "/lib/xen/bin/qemu-system-i386",
                                              (guest_archs[i].hvm ?
-                                              "/usr/lib/xen/boot/hvmloader" :
+                                              LIBXL_PREFIX "/lib/xen/boot/hvmloader" :
                                              machines)) == NULL) {

More information about the libvir-list mailing list