diff --git a/xCAT-nbroot2/dodiscovery b/xCAT-nbroot2/dodiscovery new file mode 100755 index 000000000..f5b2ddcd6 --- /dev/null +++ b/xCAT-nbroot2/dodiscovery @@ -0,0 +1,49 @@ +#!/bin/sh +minixcatd.awk & + +echo "Beginning node discovery process" +NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` +for nic in $NICSTOBRINGUP; do + dhclient $nic & + #no need to go out of our way for superfluous ipv6 nics +done +waitforlink=100 +while [ ! -z "$NICSTOBRINGUP" -a $waitforlink -gt 0 ]; do + NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v usb|grep -v ,LOWER_UP|awk -F: '{print $2}'` + waitforlink = $((waitforlink - 1)) + sleep 0.1 + if [ $waitforlink = 1 ]; then + echo "No link detected on $NICSTOBRINGUP" + fi +done +NICSGETTINGADDR=`ip link|grep mtu|grep -v LOOPBACK|grep -v usb|grep ,LOWER_UP|awk -F: '{print $2}'` +timewaiting=0 +echo "Waiting for nics to get addresses" +while [ ! -z "$NICSGETTINGADDR" -a $timewaiting != 700 ]; do + NEWNICSGETTINGADDR="" + for nic in $NICSGETTINGADDR; do + if ! ip addr show dev $nic |grep -v inet6|grep inet >/dev/null; then + NEWNICSGETTINGADDR="$NEWNICSGETTINGADDR $nic" + else + echo -n "$nic|" + ip addr show dev $nic |grep -v inet6|grep inet|sed -e s/\\/.*//|awk '{print $2}' + fi + done + sleep 0.1 + timewaiting=$((timewaiting+1)) + if [ $timewaiting = 450 ]; then + echo "45 seconds without an address on $nic, is spanning tree set to slow?" + fi + if [ $timewaiting = 699 ]; then + echo "No DHCP answer for $nic, ignoring interface" + fi + NICSGETTINGADDR=$NEWNICSGETTINGADDR +done +echo "Stopped waiting on nics to get addresses" + + + +while [ ! -r /restart ]; do + sleep 1 +done + diff --git a/xCAT-nbroot2/xcat-cmdline.sh b/xCAT-nbroot2/xcat-cmdline.sh index aab011091..9668b7fc1 100755 --- a/xCAT-nbroot2/xcat-cmdline.sh +++ b/xCAT-nbroot2/xcat-cmdline.sh @@ -6,6 +6,8 @@ echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh udevd --daemon udevadm trigger mkdir -p /var/lib/dhclient/ +ip link set lo up +ip addr add dev lo 127.0.0.1/8 if [ ! -z "$BOOTIF" ]; then BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g` echo -n "Waiting for device with address $BOOTIF to appear.." @@ -58,6 +60,7 @@ while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v done echo -n "Acquired IPv4 address " ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' - - +if [ "$destiny" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do + /bin/dodiscovery +fi /bin/dash