Files
openstack-virtual-baremetal/ipxe/script.ipxe
Jesse Pretorius (odyssey4me) 23c0c73e5f Change ipxe-boot image to try all interfaces
The current implementation will only try an iPXE
boot from eth0. This patch sets it to try all
interfaces up to 10 attempts, then reboots and
starts again.

Change-Id: I9259a275f5f1f248905755ec5955ace5b67fc2bd
2020-05-05 10:25:48 +02:00

52 lines
1.2 KiB
Plaintext
Executable File

#!ipxe
#
# This is the iPXE boot script that we embed into the iPXE binary.
#
# The default behaviour is to get DHCP and assume that DHCP includes
# the filename option. It will only try eth0. If it fails, then it
# just stops.
#
# This script makes it attempt to boot from eth0. If that fails, it
# will try the next interface. This will retry 10 times before
# rebooting.
#
# Inspired by:
# https://github.com/danderson/netboot/blob/master/pixiecore/boot.ipxe
#
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && shell ||
set attempts:int32 10
set x:int32 1
:loop
autoboot || goto retry
goto boot
:retry
echo iPXE boot failed, retrying (attempt ${x}/${attempts}).
sleep 1
iseq ${x} ${attempts} && goto fail ||
inc x
goto loop
:boot
echo Booting using ${ifname}.
# This is a hack to workaround LP bug 1845487:
# https://bugs.launchpad.net/puppet-ironic/+bug/1845487
# It should be removed when the fix for that bug is available and backported to
# all supported releases.
isset ${mtu} && echo -n Overriding MTU from dhcp of ${mtu}.
set mtu 1350
echo Set MTU to ${mtu}.
chain ${filename}
:fail
echo Failed to iPXE boot successfully after ${attempts} attempts.
echo
echo Rebooting in 5 seconds...
sleep 5
reboot