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
This commit is contained in:
parent
d3704c9bc5
commit
23c0c73e5f
|
@ -3,14 +3,14 @@
|
|||
# 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. If it fails, then it just stops.
|
||||
# the filename option. It will only try eth0. If it fails, then it
|
||||
# just stops.
|
||||
#
|
||||
# This script implements more retries until both DHCP and the filename
|
||||
# option are present. This makes sure that the underlying network has
|
||||
# plenty of time to be ready. If this still fails, then rather than
|
||||
# halt, then host will reboot to try again.
|
||||
# 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.
|
||||
#
|
||||
# Based on:
|
||||
# Inspired by:
|
||||
# https://github.com/danderson/netboot/blob/master/pixiecore/boot.ipxe
|
||||
#
|
||||
|
||||
|
@ -19,25 +19,16 @@ prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE command line... && sh
|
|||
set attempts:int32 10
|
||||
set x:int32 1
|
||||
|
||||
:dhcploop
|
||||
dhcp || goto nodhcp
|
||||
isset ${filename} || goto nobootconfig
|
||||
:loop
|
||||
autoboot || goto retry
|
||||
goto boot
|
||||
|
||||
:nodhcp
|
||||
echo -n No DHCP response
|
||||
goto retry
|
||||
|
||||
:nobootconfig
|
||||
echo -n No filename option present
|
||||
goto retry
|
||||
|
||||
:retry
|
||||
echo (attempt ${x}/${attempts}).
|
||||
echo iPXE boot failed, retrying (attempt ${x}/${attempts}).
|
||||
sleep 1
|
||||
iseq ${x} ${attempts} && goto fail ||
|
||||
inc x
|
||||
sleep 1
|
||||
goto dhcploop
|
||||
goto loop
|
||||
|
||||
:boot
|
||||
echo Booting using ${ifname}.
|
||||
|
@ -53,7 +44,7 @@ echo Set MTU to ${mtu}.
|
|||
chain ${filename}
|
||||
|
||||
:fail
|
||||
echo Failed to get a correct DHCP response after ${attempts} attempts.
|
||||
echo Failed to iPXE boot successfully after ${attempts} attempts.
|
||||
echo
|
||||
echo Rebooting in 5 seconds...
|
||||
sleep 5
|
||||
|
|
Loading…
Reference in New Issue