Create PXE-Boot image for Openstack


August 26, 2013 by kimizhang

Openstack doesn’t support launching a diskless PXE-boot VM, we have to make an image with PXE-boot capability to achieve this.

1.Create a small empty disk file, create dos filesystem.

dd if=/dev/zero of=pxeboot.img bs=1M count=4
mkdosfs pxeboot.img

2.Make it bootable by syslinux

losetup /dev/loop0 pxeboot.img
mount /dev/loop0 /mnt
syslinux --install /dev/loop0

3.Install iPXE kernel and make sysliux.cfg to load it at bootup

mount -o loop ipxe.iso /media
cp /media/ipxe.krn /mnt
cat > /mnt/syslinux.cfg <<EOF
LABEL ipxe
 KERNEL ipxe.krn
umount /media/
umount /mnt

4.Now we have pxeboot.img ready, let’s register it to glance

source nceprc
glance image-create --name NG-AS --is-public true  --disk-format raw --container-format bare < pxeboot.img

2 thoughts on “Create PXE-Boot image for Openstack

  1. Jerry says:

    Hi Kimi
    Thanks for the instruction. it helps a lot.
    Here is another issue i met after i spin up a pxe instance.
    I have a cobbler server in a vm with dhcp service listening on eth1, and the pxe instance also has an eth1. Once pxe boot from eth1 , nova-network’s dnsmasq will assign a ip for pxe vm, which will interfere with cobbler’s dhcp offer.
    Do you know how to solve this?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: