This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] Make PyGrub run first entry in grub config when inva

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Make PyGrub run first entry in grub config when invalid default boot option provided
From: Michal Novotny <minovotn@xxxxxxxxxx>
Date: Fri, 20 Mar 2009 15:14:46 +0100
Delivery-date: Fri, 20 Mar 2009 07:15:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird (X11/20090105)
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!"
-    img = g.cf.images[sel]
+    try:
+        img = g.cf.images[sel]
+    except:
+        log.debug("PyGrub: Default selection is not valid, using first boot 
+        img = g.cf.images[0]
     grubcfg = { "kernel": None, "ramdisk": None, "args": None }
Xen-devel mailing list