iPXE: Fix assumption that ${mac} is the MAC of the NIC it's booting
The ${mac} variable not necessarily points to the MAC address of the NIC we are booting from. This patch updates the boot.ipxe script to make it more robust by interating over all NICs found in the machine and boot from the first one capable of booting (the one that contains a configuration file in the server). If no NICs are capable of booting the script will fail just like before telling the user that the network boot failed because we couldn't find any configuration for the present NICs. Closes-Bug: #1504482 Change-Id: I5b8f0740fa42f611e84b66dc7f6578cffe02760a
This commit is contained in:
parent
13740f65ff
commit
1c28eb79a5
|
@ -1,10 +1,17 @@
|
|||
#!ipxe
|
||||
|
||||
# load the MAC-specific file or fail if it's not found
|
||||
chain pxelinux.cfg/${mac:hexhyp} || goto error_no_config
|
||||
# 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
|
||||
isset ${net${netid}/mac} || goto loop_done
|
||||
echo Attempting to boot from MAC ${net${netid}/mac:hexhyp}
|
||||
chain pxelinux.cfg/${net${netid}/mac:hexhyp} || goto loop
|
||||
|
||||
:error_no_config
|
||||
echo PXE boot failed. No configuration found for MAC ${mac}
|
||||
:loop_done
|
||||
echo PXE boot failed! No configuration found for any of the present NICs.
|
||||
echo Press any key to reboot...
|
||||
prompt --timeout 180
|
||||
reboot
|
||||
|
|
Loading…
Reference in New Issue