diff --git a/xCAT-nbroot/overlay/bin/minixcatd.awk b/xCAT-nbroot/overlay/bin/minixcatd.awk index 4e0bc9ba4..ef0352ded 100755 --- a/xCAT-nbroot/overlay/bin/minixcatd.awk +++ b/xCAT-nbroot/overlay/bin/minixcatd.awk @@ -9,7 +9,7 @@ BEGIN { if (match($0,"restart")) { print "restarting bootstrap process" |& listener quit="yes" - system("touch /restart") + system("echo \"" $0 "\" > /restart") system("killall sleep") close(listener) } diff --git a/xCAT-nbroot/overlay/bin/restart b/xCAT-nbroot/overlay/bin/restart index 55a498968..bff63daed 100755 --- a/xCAT-nbroot/overlay/bin/restart +++ b/xCAT-nbroot/overlay/bin/restart @@ -1,13 +1,38 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html #Redhcp, do the xcat part again +FORCENICS=`cat /restart|awk '{print $2}'` rm /restart echo -n > /tmp/dhcpserver -killall -12 udhcpc;killall -10 udhcpc -echo -n "Wating 10 seconds for DHCP changes to take effect " -for i in 1 2 3 4 5 6 7 8 9 10; do - sleep 1 - echo -n . +if [ ! -z "$FORCENICS" ]; then + echo "Forcing down nics aside from $FORCENICS due to discoverynics setting" + kill `ps axf|grep udhcpc|egrep -v "$FORCENICS"|grep -v grep|awk '{print $1}'` + for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep -v "$FORCENICS"`; do + ifconfig $nic down + done +fi +WAITING=1 +while [ $WAITING -gt 0 ]; do + killall -12 udhcpc;killall -10 udhcpc + echo -n "Wating 10 seconds for DHCP changes to take effect " + for i in 1 2 3 4 5 6 7 8 9 10; do + sleep 1 + echo -n . + done + WAITING=0 + if [ ! -z "$FORCENICS" ]; then + for nic in `ifconfig|grep HWaddr|awk '{print $1}'|egrep "$FORCENICS"`; do + if ! ifconfig $nic|grep "inet addr" > /dev/null; then + WAITING=1 + fi + done + if [ $WAITING -gt 0 ]; then + echo -n "Not all of the nics $FORCEDNICS managed to acquire an address, retrying in 30 seconds..." + sleep 30 + echo "now retrying" + fi + fi done + echo "Done waiting" /etc/init.d/S11stunnel #redo stunnel config exec /etc/init.d/S99xcat.sh diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index ba40ee5d4..4d338f7ff 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -102,6 +102,7 @@ sub process_request { } my $nrtab; my @discoverynics; + my @forcenics; #list of 'eth' style interface names to require to come up on post-discovery client dhcp restart if (defined($request->{arch})) { #Set the architecture in nodetype. If 32-bit only x86 or ppc detected, overwrite. If x86_64, only set if either not set or not an x86 family my $typetab=xCAT::Table->new("nodetype",-create=>1); @@ -152,10 +153,12 @@ sub process_request { (my $driver,my $index) = split /:/,$nic; if ($driver eq $ifinfo[0] and $index == ($bydriverindex{$driver}-1)) { $forcenic=1; #force nic to be put into database + push @forcenics,$ifinfo[1]; last; } } else { #simple 'eth2' sort of argument if ($nic eq $ifinfo[1]) { + push @forcenics,$ifinfo[1]; $forcenic=1; last; } @@ -183,7 +186,11 @@ sub process_request { $nrtab->setNodeAttribs($node,{nfsserver=>xCAT::Utils->my_ip_facing($hosttag)}); } $usednames{$hosttag}=1; + if ($hosttag eq $node) { + $macstring .= $currmac."|"; + } else { $macstring .= $currmac."!".$hosttag."|"; + } } else { if ($forcenic == 1) { $macstring .= $currmac."|"; } else { $macstring .= $currmac."!*NOIP*|"; } } @@ -209,6 +216,10 @@ sub process_request { } + my $restartstring = "restart"; + if (scalar @forcenics > 0) { + $restartstring .= " (".join("|",@forcenics).")"; + } #now, notify the node to continue life my $sock = new IO::Socket::INET ( PeerAddr => $ip, @@ -217,7 +228,7 @@ sub process_request { Proto => 'tcp' ); unless ($sock) { syslog("err","Failed to notify $ip that it's actually $node."); return; } #Give up if the node won't hear of it. - print $sock "restart"; + print $sock $restartstring; close($sock); syslog("info","$node has been discovered"); }