diff --git a/xCAT-nbroot/overlay/bin/bmcsetup b/xCAT-nbroot/overlay/bin/bmcsetup
index 27f931871..7e025eccf 100755
--- a/xCAT-nbroot/overlay/bin/bmcsetup
+++ b/xCAT-nbroot/overlay/bin/bmcsetup
@@ -1,7 +1,7 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
modprobe ipmi_si
modprobe ipmi_devintf
-while ! getipmi.awk
+while ! getipmi
do
echo "Retrying retrieval of IPMI settings from server"
done
diff --git a/xCAT-nbroot/overlay/bin/dodestiny b/xCAT-nbroot/overlay/bin/dodestiny
index 5ab243460..988a9abc6 100755
--- a/xCAT-nbroot/overlay/bin/dodestiny
+++ b/xCAT-nbroot/overlay/bin/dodestiny
@@ -19,8 +19,9 @@ while :; do
echo "Server notified us of standby condition, please check chain table".
echo "Retrying destiny in 15 seconds"
usleep 15000000 # something may be transiently wrong, check back in 15 seconds
- while ! getdestiny.awk; do
+ while ! getdestiny; do
echo "Retrying destiny retrieval"
+ usleep 300000
done
exec $0
fi
@@ -31,6 +32,7 @@ while :; do
if [ $DESTINY == "discover" ]; then
echo "MAC discovery begins"
minixcatd.awk &
+ usleep 500000 #Mitigate occurrances of 'failed to notify node'
while [ ! -r /restart ]; do
ifconfig -a|grep HWaddr|grep -v sit|awk '{print $1 "|" $5}'
MTM="unknown"
@@ -67,20 +69,23 @@ while :; do
if [ "$SERIAL" != "unknown" ]; then
echo "$SERIAL"
fi
- echo "" )| udpcat.awk $XCATMASTER $XCATPORT
- usleep 30000000
+ echo "" ) > /tmp/discout
+ cat /tmp/discout | udpcat.awk $XCATMASTER $XCATPORT
+ usleep 5000000 #Give the preferred method 5 seconds to complete before resorting
+ cat /tmp/discout | udpcat.awk `cat /tmp/dhcpserver` $XCATPORT
+ usleep 25000000
done
#Discovery complete, restart requested.
exec /bin/restart
fi
if [ $DESTINY == "reboot" ]; then
- while ! nextdestiny.awk ; do
+ while ! nextdestiny ; do
echo "Retrying next destiny..."
done
reboot -f
fi
if [ $DEST == "runcmd" ]; then
- while ! nextdestiny.awk ; do
+ while ! nextdestiny ; do
echo "Retrying next destiny..."
done
$TARG
@@ -103,7 +108,7 @@ while :; do
mkdir /tmp/$TARG
cd /tmp/$TARG
wget $TARG
- while ! nextdestiny.awk ; do
+ while ! nextdestiny ; do
echo "Retrying next destiny..."
done
tar zxvf $TARG
diff --git a/xCAT-nbroot/overlay/bin/getdestiny b/xCAT-nbroot/overlay/bin/getdestiny
new file mode 100644
index 000000000..2424160e3
--- /dev/null
+++ b/xCAT-nbroot/overlay/bin/getdestiny
@@ -0,0 +1,4 @@
+#!/bin/sh
+if ! getdestiny.awk 301; then
+ getdestiny.awk 300;
+fi
diff --git a/xCAT-nbroot/overlay/bin/getdestiny.awk b/xCAT-nbroot/overlay/bin/getdestiny.awk
index 5b823d8fe..144a169c0 100755
--- a/xCAT-nbroot/overlay/bin/getdestiny.awk
+++ b/xCAT-nbroot/overlay/bin/getdestiny.awk
@@ -1,7 +1,8 @@
#!/usr/bin/awk -f
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
BEGIN {
- ns = "/inet/tcp/0/127.0.0.1/301"
+ localport = ARGV[1]
+ ns = "/inet/tcp/0/127.0.0.1/" localport
print "" |& ns
print "getdestiny" |& ns
diff --git a/xCAT-nbroot/overlay/bin/getipmi b/xCAT-nbroot/overlay/bin/getipmi
new file mode 100644
index 000000000..f553a23bd
--- /dev/null
+++ b/xCAT-nbroot/overlay/bin/getipmi
@@ -0,0 +1,4 @@
+#!/bin/sh
+if ! getipmi.awk 301; then
+ getipmi.awk 300;
+fi
diff --git a/xCAT-nbroot/overlay/bin/getipmi.awk b/xCAT-nbroot/overlay/bin/getipmi.awk
index 2968f1c76..82a7ffb6e 100755
--- a/xCAT-nbroot/overlay/bin/getipmi.awk
+++ b/xCAT-nbroot/overlay/bin/getipmi.awk
@@ -1,7 +1,8 @@
#!/usr/bin/awk -f
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
BEGIN {
- ns = "/inet/tcp/0/127.0.0.1/301"
+ localport = ARGV[1]
+ ns = "/inet/tcp/0/127.0.0.1/" localport
print "" |& ns
print "getbmcconfig" |& ns
diff --git a/xCAT-nbroot/overlay/bin/nextdestiny b/xCAT-nbroot/overlay/bin/nextdestiny
new file mode 100755
index 000000000..399b7b4c1
--- /dev/null
+++ b/xCAT-nbroot/overlay/bin/nextdestiny
@@ -0,0 +1,4 @@
+#!/bin/sh
+if ! nextdestiny.awk 301; then
+ nextdestiny.awk 300;
+fi
diff --git a/xCAT-nbroot/overlay/bin/restart b/xCAT-nbroot/overlay/bin/restart
index 18ccd93d3..0bafa7b1b 100755
--- a/xCAT-nbroot/overlay/bin/restart
+++ b/xCAT-nbroot/overlay/bin/restart
@@ -3,4 +3,5 @@
rm /restart
killall -12 udhcpc;killall -10 udhcpc
sleep 5
+/etc/init.d/S11stunnel #redo stunnel config
/etc/init.d/S99xcat
diff --git a/xCAT-nbroot/overlay/etc/init.d/S11stunnel b/xCAT-nbroot/overlay/etc/init.d/S11stunnel
index 8e35ab024..d49a8c2f5 100755
--- a/xCAT-nbroot/overlay/etc/init.d/S11stunnel
+++ b/xCAT-nbroot/overlay/etc/init.d/S11stunnel
@@ -2,10 +2,12 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#Stunnel init for xcat:
XCATDEST=""
+killall stunnel
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
if [ "$key" == "xcatd" ]; then
XCATDEST=`echo $parm|awk -F= '{print $2}'`
+ XCATPORT=`echo $XCATDEST|awk -F: '{print $2}'`
fi
done
mkdir -p /etc/stunnel
@@ -15,5 +17,10 @@ echo 'verify=0' >> /etc/stunnel/stunnel.conf
echo '[xcatds]' >> /etc/stunnel/stunnel.conf
echo 'accept=301' >> /etc/stunnel/stunnel.conf
echo 'connect='$XCATDEST >> /etc/stunnel/stunnel.conf
+if [ -r /tmp/dhcpserver ]; then
+ echo '[dhcps]' >> /etc/stunnel/stunnel.conf
+ echo 'accept=300' >> /etc/stunnel/stunnel.conf
+ echo 'connect='`cat /tmp/dhcpserver`':'$XCATPORT >> /etc/stunnel/stunnel.conf
+fi
mkdir -p /usr/var/run/stunnel
stunnel &
diff --git a/xCAT-nbroot/overlay/etc/init.d/S99xcat b/xCAT-nbroot/overlay/etc/init.d/S99xcat
index 5c30a3d65..2e5d36a0f 100755
--- a/xCAT-nbroot/overlay/etc/init.d/S99xcat
+++ b/xCAT-nbroot/overlay/etc/init.d/S99xcat
@@ -1,7 +1,7 @@
#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
(
-while ! /bin/getdestiny.awk
+while ! /bin/getdestiny
do
echo "Retrying destiny retrieval"
done
diff --git a/xCAT-nbroot/overlay/usr/share/udhcpc/default.script b/xCAT-nbroot/overlay/usr/share/udhcpc/default.script
index ea6d89a76..6fff4b6ab 100755
--- a/xCAT-nbroot/overlay/usr/share/udhcpc/default.script
+++ b/xCAT-nbroot/overlay/usr/share/udhcpc/default.script
@@ -5,6 +5,7 @@ deconfig)
/sbin/ifconfig $interface 0.0.0.0
;;
bound|renew)
+ echo $siaddr > /tmp/dhcpserver
/sbin/ifconfig $interface $ip netmask $subnet
if [ -n "$router" ] ; then
echo "deleting routers"