more on node status update

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2278 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-10-02 21:25:57 +00:00
parent 09fd6abd37
commit e2a4902ef1
2 changed files with 28 additions and 24 deletions

View File

@ -543,15 +543,20 @@ sub getNodeStatusFromNodesetState {
my $status=$::STATUS_BOOTING; #boot, reboot, runimage
if ($nodeset =~ /^install/) { $status=$::STATUS_INSTALLING; } #linux
elsif ($nodeset =~ /^netboot/) { $status=$::STATUS_NETBOOTING;} #linux
elsif ($nodeset =~ /^discover/) { $status=$::STATUS_DISCOVERING;} #linux
elsif ($nodeset =~ /^runcmd/) { $status=$::STATUS_CONFIGURING;} #linux
elsif ($nodeset =~ /^standby/) { $status=$::STATUS_STANDING_BY;} #linux
elsif ($nodeset =~ /^shell/) { $status=$::STATUS_SHELL;} #linux
elsif (($nodeset =~ /^diskless/) || ($nodeset =~ /^dataless/)) { $status=$::STATUS_NETBOOTING;} #aix
elsif ($nodeset =~ /^standalone/) { #aix
if ($action eq "rnetboot") { $status=$::STATUS_INSTALLING; }
else { $status=$::STATUS_BOOTING; }
}
if (($action !~ /^rpower/) && ($action !~ /^rnetboot/)) {
# this section is used for dodestiny in the deployment stage
if ($nodeset =~ /^discover/) { $status=$::STATUS_DISCOVERING;} #linux
elsif ($nodeset =~ /^runcmd/) { $status=$::STATUS_CONFIGURING;} #linux
elsif ($nodeset =~ /^standby/) { $status=$::STATUS_STANDING_BY;} #linux
elsif ($nodeset =~ /^shell/) { $status=$::STATUS_SHELL;} #linux
}
return $status;
}

View File

@ -2657,40 +2657,39 @@ sub dompa {
#get new node status
my %nodestat=();
my $check=0;
my $newstat;
my $nsh={};
if ($command eq 'rpower') {
if (($args->[0] ne 'stat') && ($args->[0] ne 'status')) {
$check=1;
my @allnodes=keys %{$mpahash->{$mpa}->{nodes}};
if ($args->[0] eq 'off') { $newstat=$::STATUS_POWERING_OFF; }
else { $newstat=$::STATUS_BOOTING;}
foreach (@allnodes) { $nodestat{$_}=$newstat; }
if ($args->[0] ne 'off') {
#get the current nodeset stat
if (@allnodes>0) {
my $nsh={};
my ($ret, $msg)=xCAT::Utils->getNodesetStates(\@allnodes, $nsh);
if (!$ret) {
foreach (keys %$nsh) {
my $currstate=$nsh->{$_};
$nodestat{$_}=xCAT_monitoring::monitorctrl->getNodeStatusFromNodesetState($currstate, "rpower");
}
}
}
#get the current nodeset stat
if (@allnodes>0) {
my ($ret, $msg)=xCAT::Utils->getNodesetStates(\@allnodes, $nsh);
if ($ret) { xCAT::MsgUtils->message('S', "Cannot update node status: $msg\n"); }
}
}
}
foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
foreach $node (sort (keys %{$mpahash->{$mpa}->{nodes}})) {
$curn = $node;
my ($rc,@output) = bladecmd($mpa,$node,$mpahash->{$mpa}->{nodes}->{$node},$mpahash->{$mpa}->{username},$mpahash->{$mpa}->{password},$command,@$args);
#update the node status
if (($check) && ($rc)) {
$nodestat{$node}="error";
if ($check) {
if ($rc) { $nodestat{$node}="error"; }
else {
my $stattmp=$output[0];
if ($stattmp) {
my @atmp=split(' ', $stattmp);
my $newstat=$atmp[$#atmp];
if (($newstat eq "on") || ($newstat eq "reset")) {
my $currstate=$nsh->{$node};
$nodestat{$node}=xCAT_monitoring::monitorctrl->getNodeStatusFromNodesetState($currstate, "rpower");
} else { $nodestat{$node}=$::STATUS_POWERING_OFF;}
}
}
}
foreach(@output) {