Merge "Adding InfiniBand Support"

This commit is contained in:
Jenkins 2016-03-12 19:21:19 +00:00 committed by Gerrit Code Review
commit 4216b23654
2 changed files with 33 additions and 5 deletions

View file

@ -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
}

View file

@ -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" | \
sed -e "s/^01://g" | tr 'a-f' 'A-F')
# _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.