more work on node status

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2259 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-09-29 16:33:21 +00:00
parent d1175084d6
commit b908e634ea
3 changed files with 28 additions and 16 deletions

View File

@ -211,19 +211,23 @@ if ($inet6support) {
plugin_command(\%request,undef,\&build_response);
# exit(0);
#}
} elsif ($text =~ /netbooted/) {
my %request = (
command => [ 'updatenodestat' ],
node => [ $node ],
arg => [ 'booted' ],
);
} elsif ($text =~ /installstatus/) {
my @tmpa=split(' ', $text);
for (my $i = 1; $i <= @tmpa-1; $i++) {
my $newstat=$tmpa[$i];
my %request = (
command => [ 'updatenodestat' ],
node => [ $node ],
arg => [ "$newstat" ],
);
#node should be blocked, race condition may occur otherwise
#my $pid=xCAT::Utils->xfork();
#unless ($pid) { #fork off the nodeset and potential slowness
plugin_command(\%request,undef,\&build_response);
# exit(0);
#}
}
close($conn);
#node should be blocked, race condition may occur otherwise
#my $pid=xCAT::Utils->xfork();
#unless ($pid) { #fork off the nodeset and potential slowness
plugin_command(\%request,undef,\&build_response);
# exit(0);
#}
} elsif ($text =~ /^unlocktftpdir/) { #TODO: only nodes in install state should be allowed
mkpath("$tftpdir/xcat/$node");
chmod 01777,"$tftpdir/xcat/$node";

View File

@ -84,6 +84,7 @@ if (&runcmd($chcmd) != 0) {
}
# check & run the postscript
my $nodesetstat="standalone";
if (-f $scriptname)
{
if (@ARGV>0) {
@ -97,6 +98,9 @@ if (-f $scriptname)
`echo "$POSTS" | tr "," "\n" >> $scriptname`;
}
$nodesetstat=`grep "NODESETSTATE=" $scriptname|awk -F \= '{print \$2}'`;
chomp($nodesetstat);
if (&runcmd("cd /xcatpost;$scriptname") != 0)
{
print "$::sdate xcataixpost: Could not run $scriptname.\n";
@ -112,7 +116,7 @@ if (-f $scriptname)
}
if (@ARGV<1) {
if (&updateflag != 0) {
if (&updateflag($nodesetstat) != 0) {
print "$::sdate xcataixpost: Failed to update the xCAT server.\n";
print $::LOG_FILE "$::sdate xcataixpost: Failed to update the xCAT server..\n";
close($::LOG_FILE);
@ -173,7 +177,11 @@ sub getmypost {
#
############################################################
sub updateflag {
print "updateflag servicenode=$servnode\n";
my $nodesetstat=shift;
my $state="netbooted";
if ($nodesetstat eq "standalone") { $state="installed booting"; }
my $port = "3002";
my $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $servnode, PeerPort => $port, );
unless ($remote) {
@ -187,7 +195,7 @@ sub updateflag {
while (defined ($line = <$remote>)) {
chomp $line;
if ($line eq "ready") {
print $remote "netbooted\n";
print $remote "installstatus $state\n";
} elsif ($line eq "done") {
last;
}

View File

@ -84,7 +84,7 @@ fi
if [ $# -eq 0 ]; then
#notify the server that we are done with netbooting
echo "updateflag.awk \$MASTER 3002 netbooted" >> /tmp/mypostscript
echo "updateflag.awk \$MASTER 3002 \"installstatus booted\"" >> /tmp/mypostscript
fi
chmod +x /tmp/mypostscript