summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/boot.ipxe
blob: 95d95686a5cbedc159d878a575056448eb46a483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!ipxe

# NOTE(lucasagomes): Loop over all network devices and boot from
# the first one capable of booting. For more information see:
# https://bugs.launchpad.net/ironic/+bug/1504482
set netid:int32 -1
:loop
inc netid || chain {{ ipxe_for_mac_uri }}${mac:hexhyp} || goto old_rom
isset ${net${netid}/mac} || goto loop_done
echo Attempting to boot from MAC ${net${netid}/mac:hexhyp}
chain {{ ipxe_for_mac_uri }}${net${netid}/mac:hexhyp} || goto loop

# If we've got here the chained config returned success
# suggesting "sanboot" in boot_whole_disk failed (some UEFI cases)
# exit 0 so the bios continues to the next device
echo Exiting pxe config to allow boot to continue on next device
exit 0

:loop_done
{% if ipxe_fallback_script -%}
chain {{ ipxe_fallback_script }} | goto boot_failed

:boot_failed
{% endif -%}
echo PXE boot failed! No configuration found for any of the present NICs.
echo Press any key to reboot...
prompt --timeout 180
reboot

:old_rom
{% if ipxe_fallback_script -%}
chain {{ ipxe_fallback_script }} | goto boot_failed_old_rom

:boot_failed_old_rom
{% endif -%}
echo PXE boot failed! No configuration found for NIC ${mac:hexhyp}.
echo Please update your iPXE ROM and retry.
echo Press any key to reboot...
prompt --timeout 180
reboot