pypxeboot

pypxeboot is a bootloader for Xen guests that simulates a PXE client. pypxeboot runs on the Domain 0 as part of the creation of a new domain, and requests an IP address and configuration information on behalf of the as-yet uncreated guest (DomU).

pypxeboot uses a modified version of udhcp that allows a MAC address to be specified on the command line. A patch against verion 0.9.8 of udhcp is included in the tarball.

Version 0.0.2 uses the tftp command line client. Version 0.0.3 is a substantial re-write thanks to Magnus Leuthner which uses tftpy and provides a lot more flexibility.

Version 0.0.2

For version 0.0.2 you will need the tftp program installed: source and RPMs are here.

Version 0.0.3

For version 0.0.3 you will need tftpy. This is available as package python-tftpy in Fedora, Debian, Ubuntu repositories. For RHEL users, it should be possible to rebuild the python-tftpy SRPM for Fedora.

Download

Version 0.0.2

A tarball including pypxeboot, the patch for udhcp and the script for udhcp to output information retrieved from the DHCP server is available here: pypxeboot-0.0.2.tar.gz.

RPMs for pypxeboot 0.0.2 and the modified udhcp are also available. (Thanks to Kurt C. Hackel for the spec files and to Andrea Chierici for the SL3/4 RPMs.)

Fedora Core 6Scientific Linux 3/4Source
pypxebootRPMRPMSRPM
udhcpRPMRPMSRPM

Version 0.0.3

A tarball including pypxeboot, the patch for udhcp and the script for udhcp to output information retrieved from the DHCP server is available here: pypxeboot-0.0.3.tar.gz.

A noarch RPM for pypxeboot 0.0.3 (untested!) is also available.

Note: this RPM depends on the python-tftpy package.

Installation

  1. Download udhcp, patch it, build it and install it. Download and install tftp. Download pypxeboot.
  2. Copy pypxeboot to /usr/bin and outputpy.udhcp.sh to /usr/share/udhcpc
  3. Add the following lines to the Xen configuration file for the domain:
    bootloader="/usr/bin/pypxeboot"
    vif=['mac=AA:00:86:e2:35:72']
    bootargs=vif[0]
    

Now when you do

xm create "domain-name"
you should see output like this if the pxelinux.cfg entry is set to localboot:

[root@tg23 pypxeboot]# xm create  cagnode50-slc308
Using config file "/etc/xen/cagnode50-slc308".
pypxeboot: requesting info for MAC address AA:00:86:e2:35:72
pypxeboot: getting cfg for IP 134.226.53.114 (86E23572) from server 192.168.12.1
pypxeboot: dropping to pygrub for local boot
Going to boot Scientific Linux CERN Xen DomU-xenU (2.4.21-47.0.1.EL.cernxenU)
  kernel: /vmlinuz-2.4.21-47.0.1.EL.cernxenU
  initrd: /initrd-2.4.21-47.0.1.EL.cernxenU.img

and something like this if the pxelinux.cfg entry specifies a network boot:

[root@tg23 pypxeboot]# xm create  cagnode50-slc308
Using config file "/etc/xen/cagnode50-slc308".
pypxeboot: requesting info for MAC address AA:00:86:e2:35:72
pypxeboot: getting cfg for IP 134.226.53.114 (86E23572) from server 192.168.12.1
pypxeboot: downloading initrd using cmd: tftp -c get 192.168.12.1:slc308_i386_xen/initrd.img
pypxeboot: downloading kernel using cmd: tftp -c get 192.168.12.1:slc308_i386_xen/vmlinuz
Started domain cagnode50

N.B. the kernel and initrd on the tftp server must be Xen Linux kernels.

Issues

pypxeboot assumes a lot about the pxelinux setup on the server. In particular it assumes that configuration files are in the directory pxelinux.cfg and it also only copes with single-entry config files. Ideally, pypxeboot should use the virtual interface to be set up for the VM in order to ensure that the right bridge is used. (It should also use the right IP address for the VM when performing TFTP transfers.)

When rebooting a domain with the stock xend, the PXE negotiation fails. This is because pypxeboot is trying to do PXE for the VM from Dom0 before the DomU networking has been torn down. I have been able to get around this problem using a small patch that delays bootloader execution until after the previous DomU has been shut down. This patch xen-bootloader-reboot.patch is compatible with Xen 3.0.3 and may work with other Xen 3.0 series releases. It should be applied to XendDomainInfo.py.

Related stuff

If you're interested in getting anaconda/kickstart working for Xen DomUs, Linux Support at CERN have some suitable installation images and instructions available for SLC3/4 (RHEL3/4 compatible).

pypxeboot was written by Stephen Childs. © 2007 Trinity College Dublin. Email help at grid dot ie if you have feedback, problems, bug reports.


Last modified Wed 17 February 2010 . View page history
Switch to HTTPS . Website Help . Print View . Built with GridSite 1.1.21