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

[Xen-changelog] [xen-unstable] libxl: Look for bootloader in libexec path


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 18 May 2012 17:11:10 +0000
  • Delivery-date: Fri, 18 May 2012 17:11:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User George Dunlap <george.dunlap@xxxxxxxxxxxxx>
# Date 1337095690 -3600
# Node ID 373f24c87deee775e9a1f0c1d7e1d29b942e0175
# Parent  a3186b243e2db2761becfad3452290a1b385cf1c
libxl: Look for bootloader in libexec path

If the full path for a bootloader (such as pygrub or xenpvnetboot) is not
given, check for it first in the libexec path before falling back to the
PATH variable.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r a3186b243e2d -r 373f24c87dee tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Tue May 15 15:41:53 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c    Tue May 15 16:28:10 2012 +0100
@@ -336,6 +336,26 @@ void libxl__bootloader_run(libxl__egc *e
         goto out;
     }
 
+    LOG(DEBUG, "Config bootloader value: %s", info->u.pv.bootloader);
+
+    /* If the full path is not specified, check in the libexec path */
+    if ( info->u.pv.bootloader[0] != '/' ) {
+        char *bootloader;
+        struct stat st;
+
+        bootloader = libxl__abs_path(gc, info->u.pv.bootloader,
+                                     libxl__libexec_path());
+        /* Check to see if the file exists in this location; if not,
+         * fall back to checking the path */
+        LOG(DEBUG, "Checking for bootloader in libexec path: %s", bootloader);
+
+        if ( lstat(bootloader, &st) )
+            LOG(DEBUG, "%s doesn't exist, falling back to config path",
+                bootloader);
+        else
+            info->u.pv.bootloader = bootloader;
+    }
+
     make_bootloader_args(gc, bl);
 
     bl->openpty.ao = ao;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.