Adding InfiniBand Support
This patch update the find_interface to lookup for InfiniBand interface according to it's BOOTIF Closes-Bug: #1532534 Change-Id: I21b91cfd10888ac036f6347a0a44cdca422830a6
This commit is contained in:
parent
352e58ceb7
commit
14b900d3c9
@ -161,11 +161,24 @@ function partition_name() {
|
||||
|
||||
function find_interface() {
|
||||
local mac=$1
|
||||
eth=`ifconfig -a | grep -i "$mac" | awk {' print $1 '} | head -n 1`
|
||||
if [ -n "$eth" ]; then
|
||||
echo "$eth"
|
||||
local interface
|
||||
interface=$(ip link show | grep -B1 -i $mac | awk '/mtu/ { print $2 }')
|
||||
if [ -n "$interface" ]; then
|
||||
echo "${interface%:}"
|
||||
return 0
|
||||
else
|
||||
# Note(moshele): try to find the InfinBand interface by
|
||||
# matching the InfinBand MAC upper and lower
|
||||
# 3 octets to the GUID lower and upper 3 octets.
|
||||
local upper_octs=${mac:0:8}
|
||||
local lower_octs=${mac:9:16}
|
||||
ib_re="${upper_octs}:[A-F0-9][A-F0-9]:[A-F0-9][A-F0-9]:${lower_octs}"
|
||||
interface=$(ip link show | grep -B1 -i ${ib_re} | grep mtu | \
|
||||
awk {'print $2'})
|
||||
if [ -n "$interface" ]; then
|
||||
echo "${interface%:}"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -16,8 +16,23 @@ fi
|
||||
|
||||
readonly _BOOTIF_=$(get_kernel_parameter BOOTIF)
|
||||
readonly _IP_=$(get_kernel_parameter ip)
|
||||
readonly BOOT_MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \
|
||||
|
||||
# _BOOTIF_ is the hardware type with the MAC address
|
||||
# see http://www.syslinux.org/wiki/index.php/PXELINUX
|
||||
if [[ $_BOOTIF_ =~ ^20.* && ${#_BOOTIF_} == 20 ]]; then
|
||||
# InfiniBand hardware type is 20 with InfiniBand MAC
|
||||
# For example InfiniBand GID:
|
||||
# 80:00:02:08:fe:80:00:00:00:00:00:00:f4:52:14:03:00:3a:16:b1
|
||||
# is converted to BOOTIF 20:f4:52:14:3a:16:b1
|
||||
MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \
|
||||
sed -e "s/^20://g" | tr 'a-f' 'A-F')
|
||||
else
|
||||
# Ethernet BOOTIF hardware type is 01 with MAC
|
||||
MAC_ADDRESS=$(echo "$_BOOTIF_" | sed -e "s/-/:/g" | \
|
||||
sed -e "s/^01://g" | tr 'a-f' 'A-F')
|
||||
fi
|
||||
|
||||
readonly BOOT_MAC_ADDRESS=$MAC_ADDRESS
|
||||
|
||||
# If bootloader did not pass on network info, we fallback to a kernel
|
||||
# parameter to locate the address of the boot server.
|
||||
|
Loading…
Reference in New Issue
Block a user