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

[Xen-devel] [PATCH] Make PyGrub run first entry in grub config when invalid default boot option provided



Hello everybody,
I have created a patch for pygrub and I am sending it as an attachment. This patch mainly solves the issue of invalid default boot option in VM's configuration. If the entry doesn't exist, it doesn't exit with IndexError python exception but it uses first entry there to boot up the machine - same way like standard (real) grub does...

Signed-off-by: Michal Novotny <minovotn@xxxxxxxxxx>
diff -r e1562a36094e tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Thu Mar 19 17:04:06 2009 +0000
+++ b/tools/pygrub/src/pygrub   Fri Mar 20 15:09:31 2009 +0100
@@ -530,7 +530,11 @@
         print "No kernel image selected!"
         sys.exit(1)
 
-    img = g.cf.images[sel]
+    try:
+        img = g.cf.images[sel]
+    except:
+        log.debug("PyGrub: Default selection is not valid, using first boot 
configuration...")
+        img = g.cf.images[0]
 
     grubcfg = { "kernel": None, "ramdisk": None, "args": None }
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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