From df134bf16600ea38f39de6c995a52a9b05b9fecc Mon Sep 17 00:00:00 2001 From: Phil Cayton Date: Tue, 19 Aug 2014 12:11:31 -0700 Subject: [PATCH] Changes to ofed-mic script to better handle IPoIB interfaces List IPoIB interfaces brought up on card following card name and colon (:), ie mic0 : ib0 ib1 If IF on card fails to come up (ie ifup ib0 fails), print offending card and interface, keep trying other interfaces. If any IPoIB interfaces fail to come up don't assume card does not exist and try other hostnames. --- ofed_scripts/ofed-mic | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ofed_scripts/ofed-mic b/ofed_scripts/ofed-mic index 4ad6b08..0f6d487 100755 --- a/ofed_scripts/ofed-mic +++ b/ofed_scripts/ofed-mic @@ -91,31 +91,39 @@ start_mic() # load ibscif first with any options: $ssh $1 /sbin/modprobe ibscif $ibscif_opt && $ssh $1 /etc/init.d/ibmodules start &> /dev/null - - errors+=$? + [ $? != 0 ] && return 1 conf=/etc/mpss/ipoib.conf if [ -f "$conf" ]; then source "$conf" if [ "${ipoib_enabled}" == "yes" ] ; then - once=0 - echo -n -\ $ssh $1 modprobe ib_ipoib ${ipoib_parms} + [ $? != 0 ] && return 1 sleep 2 ipoib_list=`ls $sysfs/class/net | grep ib` for i in $ipoib_list ; do card_if=$2_$i IP=${!card_if} if [ ! -z "$IP" ] ; then + # print once after "micN" + [ -z "$once" ] && echo -ne ": " once=1 - echo -n $i\ - mode=`cat $sysfs/class/net/$i/mode` - $ssh $1 echo $mode \> /sys/class/net/$i/mode + $ssh $1 ifconfig $i $IP + # if fail to bring up IF, log and keep trying others + if [ $? != 0 ] ; then + errors+=1 + echo $card_if failed + continue + else + echo -ne "$i " + fi + + mode=`cat $sysfs/class/net/$i/mode` && + $ssh $1 echo $mode \> /sys/class/net/$i/mode errors+=$? fi done - if [ $once -eq 1 ] ; then echo -n -\ ; fi fi fi -- 2.41.0