-aggressively use discoverednics

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5302 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-02-26 00:02:22 +00:00
parent aa5c2d14d3
commit 7337f8f75a
3 changed files with 43 additions and 7 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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");
}