WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] pypxeboot bootloader

To: Stephen Childs <Stephen.Childs@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] pypxeboot bootloader
From: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
Date: Mon, 5 Feb 2007 17:36:12 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 05 Feb 2007 09:36:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <45C7114E.10207@xxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <45C7114E.10207@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
Hi, 

At 11:13 +0000 on 05 Feb (1170673998), Stephen Childs wrote:
> As promised on Friday here is the patch for the pypxeboot bootloader. It 
> would be great if someone could try it out and give me some feedback.

First impressions: this looks really useful but has a few rough edges
that need to be knocked off.  (I haven't had a chance to try this on a
real machine yet.)

> +for line in udhcplines:
> +    s = line.strip()
> +    f = s.split()
> +
> +    if s[0]=='{' and s[-1]=='}':
> +        dhcpinfo=eval(s, {"__builtins__" : {}})
> +        for k in dhcpinfo:
> +            dhcpinfo[k]=dhcpinfo[k].strip()

Executing the results of programs scares me.  Could you just parse it?

> +ipaddr=dhcpinfo['ip']
> +ipaddrlist=ipaddr.split('.')
> +hexip=commands.getstatusoutput("/usr/bin/gethostip -x "+ipaddr)[1]

This requires syslinux to be installed on the Xen host, and isn't 
hard to do by hand: "%2.2x%2.2x%2.2x%2.2x" % tuple(map (int, ipaddrlist))
(I'm sure more heavyweight python hackers can correct my style.)

> +tmpdir="/var/lib/xen/"
> +
> +os.chdir(tmpdir)
> +commandstr="tftp -c get "+servaddr+":pxelinux.cfg/"+hexip
> +#print "running command "+commandstr
> +getpxeres=commands.getstatusoutput(commandstr)

You'll need to be more careful with temporary file names -- here at
least the filename is unique to the guest (we hope!) but for the kernel
etc., two boots could clash.  Also, you don't seem to remove the
downloaded config files.

Cheers,

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, XenSource UK Limited
Registered office c/o EC2Y 5EB, UK; company number 05334508

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