From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: [Patch] tweak error reporting for bootloader errors in xm Date: Mon, 6 Nov 2006 15:14:33 +0000 Message-ID: <20061106151430.GA9932@redhat.com> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw" Return-path: Content-Disposition: inline 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 --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Signed-off-by: Daniel P, Berrange Regards, Dan. -- |=- 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 -=| --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xm-bootloader-errors.patch" diff -r 20204db0891b tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Thu Nov 02 18:52:04 2006 +0000 +++ b/tools/python/xen/xm/create.py Mon Nov 06 10:11:05 2006 -0500 @@ -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] --GvXjxJ+pjyke8COw 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 --GvXjxJ+pjyke8COw--