diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 62fc1b60c..48c7ca2cd 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -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"; diff --git a/xCAT/postscripts/xcataixpost b/xCAT/postscripts/xcataixpost index f879d0c56..79354ef49 100644 --- a/xCAT/postscripts/xcataixpost +++ b/xCAT/postscripts/xcataixpost @@ -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; } diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 7c6b93d42..26f6b6f40 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -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