From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Novotny Subject: [PATCH] pyGrub: Fix default when out of range Date: Mon, 28 Jun 2010 19:26:15 +0200 Message-ID: <4C28DB37.1020100@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070507070306010508040203" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "'xen-devel@lists.xensource.com'" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------070507070306010508040203 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 -- Michal Novotny, RHCE Virtualization Team (xen userspace), Red Hat --------------070507070306010508040203 Content-Type: text/x-patch; name="xen-pygrub-fix-default-out-of-range.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-pygrub-fix-default-out-of-range.patch" 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) --------------070507070306010508040203 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------070507070306010508040203--