From bc6bcc869e05784666f8a33b6a40ed8d230af639 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 19 Mar 2008 18:33:48 +0000 Subject: [PATCH] -More complex network wait semantics: -Move all waiting to a common loop, waiting a total of no more than 80 seconds for all nics -Give up after 15 seconds with no link-up reported by ethtool -Detect suspect spanning-tree. -Record spanning-tree suspicion, no link, and total dhcp timeouts to /etc/motd -Have /etc/profile in nbroot cat /etc/motd, to make ssh into shell report diagnostic messages git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@843 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-nbroot/overlay/etc/init.d/S10autodetect | 34 +++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/xCAT-nbroot/overlay/etc/init.d/S10autodetect b/xCAT-nbroot/overlay/etc/init.d/S10autodetect index 7111c8da3..b4b4a05c6 100755 --- a/xCAT-nbroot/overlay/etc/init.d/S10autodetect +++ b/xCAT-nbroot/overlay/etc/init.d/S10autodetect @@ -4,6 +4,8 @@ nic=0 hba=0 MOD="" +NICSTOWAIT="" +echo "cat /etc/motd" >> /etc/profile #Load common usb drivers modprobe ohci-hcd @@ -45,12 +47,9 @@ do echo "alias myri0 $MOD" >>/etc/modprobe.conf else modprobe $MOD - udhcpc -i eth$nic -b - let extrat=0 - until ifconfig eth$nic|grep "inet addr" || [ $extrat == 30 ]; do - sleep 1 - let extrat=extrat+1 - done + ifconfig eth$nic up + udhcpc -i eth$nic -b & + NICSTOWAIT="$NICSTOWAIT eth$nic" nic=$(($nic + 1)) fi ;; @@ -94,5 +93,24 @@ if [ -d /proc/device-tree/lhea* ]; then done fi -#Give 5 seconds for things to quiesce. -sleep 5 +let extrat=0 +until [ $extrat == 80 -o -z "$NICSTOWAIT" ]; do + sleep 1 + let extrat=extrat+1 + for nic in $NICSTOWAIT; do + if ifconfig $nic|grep "inet addr"; then + NICSTOWAIT=`echo $NICSTOWAIT|sed -e s/$nic//` + if [ $extrat -gt 45 ]; then + echo "Warning: $nic took more than 45 seconds to receive DHCP reply, spanning-tree may not be configured well, examine switch configuration" >> /etc/motd + fi + elif [ $extrat == 15 ]; then + if ethtool $nic | grep "Link detected: no"; then + echo "$nic did not have any link when bringing up network" >> /etc/motd + NICSTOWAIT=`echo $NICSTOWAIT|sed -e s/$nic//` + fi + fi + done +done +if [ ! -z "$NICSTOWAIT" ]; then + echo "Warning: the following network devices appeared to be connected to networks, but received no DHCP response: $NICSTOWAIT" +fi