Skip to contentSkip to conversation

libxl: fix paths in capability string

RFC PATCH Frediano Ziglio 7 participants 12 messages Jan 6, 2015 – Jan 7, 2015 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

2015-01-06 16:12 GMT+00:00 Wei Liu <[email protected]>:

Quoted 7 lines

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.

Quoted 6 lines

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.

Wouldn't then better to separate it in a different patch?

Also this make libvirt not compatible with former Xen versions. Is this expected?

Frediano

Quoted 56 lines

---
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(-)
configure.ac +4 -0
index 167b875..8d10361 100644
@@ -533,6 +533,9 @@ AC_ARG_WITH([libxl],
   [AS_HELP_STRING([--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"])
 AC_ARG_WITH([vbox],
   [AS_HELP_STRING([--with-vbox=@<:@PFX@:>@],
     [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])
+    AC_DEFINE_UNQUOTED([LIBXL_PREFIX], ["$LIBXL_PREFIX"], [libxl prefix])
 fi
 AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"])
 
src/libxl/libxl_conf.c +2 -5
index 0555b91..fbb4e29 100644
@@ -428,11 +428,9 @@ libxlCapsInitGuests(libxl_ctx *ctx, virCapsPtr caps)
         if ((guest = virCapabilitiesAddGuest(caps,
                                              guest_archs[i].hvm ? "hvm" : "xen",
                                              guest_archs[i].arch,
-                                             ((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" :
                                               NULL),
                                              1,
                                              machines)) == NULL) {
--

1.7.10.4

#2 lore raw
Quoted 11 lines · Frediano Ziglio

2015-01-06 16:12 GMT+00:00 Wei Liu <[email protected]>:

Quoted 10 lines

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.

Quoted 9 lines
Quoted 3 lines

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

Wouldn't then better to separate it in a different patch?

Also this make libvirt not compatible with former Xen versions. Is this expected?

No. I don't want to break compatibility. However these strings are not used in libxl driver so there's nothing to break.

I'm not very familiar with libvirt so I could be wrong. Corrections welcome. :-/

Wei.

#3 lore raw
In reply to a message not in the archive
Quoted 2 lines · Wei Liu

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

What about people who use --libdir=/path/to/lib64, as I believe Red Hat derived distros still do, don't they?

Ian.

#4 lore raw
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Wei Liu

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

What about people who use --libdir=/path/to/lib64, as I believe Red Hat derived distros still do, don't they?

Ian.

Redhat et al do indeed use /usr/lib64, although some of the recent autoconf work has moved some of the binaries into /usr/libexec.

~Andrew

#5 lore raw
In reply to Ian Campbell
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Wei Liu

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

What about people who use --libdir=/path/to/lib64, as I believe Red Hat derived distros still do, don't they?

Good point. I can't say for sure.

If they do so we might need to add more --with-libxl-FOO? Essentially we need to export all dirs configured for Xen?

Wei.

Quoted 1 line

Ian.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 9 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 2 lines · Wei Liu

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

What about people who use --libdir=/path/to/lib64, as I believe Red Hat derived distros still do, don't they?

Quoted 6 lines

Good point. I can't say for sure.

If they do so we might need to add more --with-libxl-FOO? Essentially we need to export all dirs configured for Xen?

From your patch it looks like only two matter, libdir/boot and

libdir/bin. Or maybe configure $qemupath and hvmloaderpath directly?

Ian.

#8 lore raw
In reply to a message not in the archive
Quoted 6 lines · Wei Liu

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.

Why can't you just make '--with-libxl=/path/to/alt' work? That is, --with-libxl=yes uses a default (which matches the prefix where LIBVIRT will be installed [1]), --with-libxl=no turns it off, and specifying a path says to use that path. Then you don't need to add a new option.

[1] The assumption generally is that whoever is building libvirt has also built libxl to be installed in the same location - which is a nicer default than hard-coding a /usr/local default that libxl uses in isolation. Of course, libvirt also defaults to /usr/local in isolation, so if you don't specify anything at all, then ./configure will see that libvirt is going into /usr/local and will therefore default to looking for libxl also in /usr/local; but for a distro packager, it is nicer to have the mere specification of --prefix switch all other relative defaults to play nicely with everything else in the distro.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 4 lines · Eric Blake
Quoted 3 lines · Wei Liu

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

Quoted 8 lines
Quoted 3 lines

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.

Why can't you just make '--with-libxl=/path/to/alt' work? That is, --with-libxl=yes uses a default (which matches the prefix where LIBVIRT will be installed [1]), --with-libxl=no turns it off, and specifying a path says to use that path. Then you don't need to add a new option.

Yep, that would be preferrable.

Alternatively the next best would be for xen to include a pkg-config configuration file, with a custom variable that reports the paths required

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#11 lore raw
In reply to a message not in the archive
Quoted 4 lines · Eric Blake
Quoted 3 lines · Wei Liu

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

Quoted 9 lines
Quoted 3 lines

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.

Why can't you just make '--with-libxl=/path/to/alt' work? That is, --with-libxl=yes uses a default (which matches the prefix where LIBVIRT will be installed [1]), --with-libxl=no turns it off, and specifying a path says to use that path. Then you don't need to add a new option.

But --with-libxl is used to specify build time path which can be different from runtime path if I build libvirt against a non-installed version of xen.

Consider I have a non-installed build of libxl in /local/scratch/xen.git/dist/install/usr/local but not /usr/local. I don't want that "/local/scratch..." end up in capability string.

Wei.

Quoted 21 lines

[1] The assumption generally is that whoever is building libvirt has also built libxl to be installed in the same location - which is a nicer default than hard-coding a /usr/local default that libxl uses in isolation. Of course, libvirt also defaults to /usr/local in isolation, so if you don't specify anything at all, then ./configure will see that libvirt is going into /usr/local and will therefore default to looking for libxl also in /usr/local; but for a distro packager, it is nicer to have the mere specification of --prefix switch all other relative defaults to play nicely with everything else in the distro.

Signature · 10 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org




_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 14 lines · Daniel P. Berrange
Quoted 4 lines · Eric Blake
Quoted 3 lines · Wei Liu

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

Quoted 8 lines
Quoted 3 lines

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.

Why can't you just make '--with-libxl=/path/to/alt' work? That is, --with-libxl=yes uses a default (which matches the prefix where LIBVIRT will be installed [1]), --with-libxl=no turns it off, and specifying a path says to use that path. Then you don't need to add a new option.

Quoted 6 lines

Yep, that would be preferrable.

Alternatively the next best would be for xen to include a pkg-config configuration file, with a custom variable that reports the paths required

This might be a useful thing in its own right. Thanks for the suggestion.

Wei.

Quoted 12 lines

Regards,
Daniel

Signature · 9 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw
Quoted 3 lines · Wei Liu

Jim, another idea: if those strings are likely to be wrong and in fact not used, can we just not print them?

IMO they are useful, particularly when they are correct :-). They allow users to see which emulators are available and their complete path, which in turn can be directly used in the <emulator> element in domainXML.

I do agree that a configure option for libvirt is the way to go here, allowing packagers to specify where these binaries exist. I recall discussions at a past Xen hackathon around the preference to use the distro's qemu instead of the one provided by Xen. A configure option for libvirt would facilitate that.

Regards,
Jim