Skip to contentSkip to conversation

tweak error reporting for bootloader errors in xm

PATCH Applied Daniel P. Berrange 2 participants 2 messages Nov 6, 2006 – Dec 7, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tweak error reporting for bootloader errors in xm

The xm command does some basic validation of the 'bootloader' parameter before trying to run it, however, the level of detail reported isn't as clear as it could be.

For example if I typo the bootloader param it says:

  # xm create XenGuest1
  Using config file "XenGuest1".
  Error: Bootloader isn't executable

The attached patch makes it do an explicit check for path existance prior to the one for executable permissions. It also prints out the path being tested.

  # xm create XenGuest1
  Using config file "XenGuest1".
  Error: Bootloader '/usr/sbin/pygrub' does not exist

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
tools/python/xen/xm/create.py +3 -1
diff -r 20204db0891b tools/python/xen/xm/create.py
@@ -671,8 +671,10 @@ def configure_hvm(config_image, vals):
     config_image.append(['vncpasswd', vals.vncpasswd])
 
 def run_bootloader(vals, config_image):
+    if not os.access(vals.bootloader, os.F_OK):
+        err("Bootloader '%s' does not exist" % vals.bootloader)
     if not os.access(vals.bootloader, os.X_OK):
-        err("Bootloader isn't executable")
+        err("Bootloader '%s' isn't executable" % vals.bootloader)
     if len(vals.disk) < 1:
         err("No disks configured and boot loader requested")
     (uname, dev, mode, backend) = vals.disk[0]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw
Quoted 14 lines · Daniel P. Berrange

The xm command does some basic validation of the 'bootloader' parameter before trying to run it, however, the level of detail reported isn't as clear as it could be.

For example if I typo the bootloader param it says:

  # xm create XenGuest1
  Using config file "XenGuest1".
  Error: Bootloader isn't executable

The attached patch makes it do an explicit check for path existance prior to the one for executable permissions. It also prints out the path being tested.

Quoted 6 lines
  # xm create XenGuest1
  Using config file "XenGuest1".
  Error: Bootloader '/usr/sbin/pygrub' does not exist

Applied, thanks, and sorry for the delay.

Ewan.