All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pyGrub: Fix default when out of range
@ 2010-06-28 17:26 Michal Novotny
  2010-06-29 13:54 ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Novotny @ 2010-06-28 17:26 UTC (permalink / raw)
  To: 'xen-devel@lists.xensource.com'

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

Hi,
this is the patch to fix pyGrub default value when it's being set out of 
range. This patch makes the quiet and interactive mode select the same 
default image when the default value for boot entry is out of range, 
i.e. when the guest is having wrong configuration in it's boot loader 
(like 3 entries with default mistakenly set to 10 etc).

When the boot entry number is being set out of range it falls back to 0 
(first entry of boot loader).

Michal

Signed-off-by: Michal Novotny <minovotn@redhat.com>

-- 
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat


[-- Attachment #2: xen-pygrub-fix-default-out-of-range.patch --]
[-- Type: text/x-patch, Size: 560 bytes --]

diff -r 7b00193bd033 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Mon Jun 28 17:40:16 2010 +0100
+++ b/tools/pygrub/src/pygrub	Mon Jun 28 19:21:20 2010 +0200
@@ -415,6 +415,9 @@ class Grub:
         timeout = int(self.cf.timeout)
 
         self.selected_image = self.cf.default
+        # If the selected (default) image doesn't exist we select the first entry
+        if self.selected_image > len(self.cf.images):
+            self.selected_image = 0
         self.isdone = False
         while not self.isdone:
             self.run_main(timeout)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-29 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28 17:26 [PATCH] pyGrub: Fix default when out of range Michal Novotny
2010-06-29 13:54 ` Ian Jackson
2010-06-29 14:24   ` Michal Novotny
2010-06-29 15:23     ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.