Open bensallen opened 2 years ago
Will generalize https://github.com/warewulf/warewulf3/blob/development/provision/initramfs/init#L428 into a function so it can be called there and within bondup. Something like:
find_interface() {
local HWADDR=$1
local DEV
for DEV in $(echo /sys/class/net/* | xargs -n1 /usr/bin/basename | grep -v lo); do
local DEVHWADDR=$(cat /sys/class/net/$DEV/address)
# Use GUID if IB
if [ ${#DEVHWADDR} -eq 59 ]; then
DEVHWADDR=$(expr substr $DEVHWADDR 37 23)
fi
if [ $DEVHWADDR == $HWADDR ]; then
echo $DEV
return 0
fi
done
return 1
}
Similar to what is currently done for normal interfaces at https://github.com/warewulf/warewulf3/blob/development/provision/initramfs/init#L428, fallback to matching against HWADDR for bonding devices. Currently only interface names are matched against in bondup().