handle no-op situation for node status update
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2280 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
d71ffa4c4f
commit
183eef7202
@ -196,6 +196,7 @@ my $mpa;
|
||||
my $allinchassis=0;
|
||||
my $curn;
|
||||
my @cfgtext;
|
||||
my $status_noop="XXXno-opXXX";
|
||||
|
||||
|
||||
sub fillresps {
|
||||
@ -1482,26 +1483,34 @@ sub power {
|
||||
return (1,"$subcommand unsupported on the management module");
|
||||
}
|
||||
}
|
||||
if ($subcommand eq "stat" or $subcommand eq "boot") {
|
||||
$validsub=1;
|
||||
$data = $session->get([$powerstatoid.".".$slot]);
|
||||
if ($data == 1) {
|
||||
$stat = "on";
|
||||
} elsif ( $data == 0) {
|
||||
$stat = "off";
|
||||
} else {
|
||||
$stat= "error";
|
||||
}
|
||||
} elsif ($subcommand eq "off") {
|
||||
|
||||
#get stat first
|
||||
$validsub=1;
|
||||
$data = $session->get([$powerstatoid.".".$slot]);
|
||||
if ($data == 1) {
|
||||
$stat = "on";
|
||||
} elsif ( $data == 0) {
|
||||
$stat = "off";
|
||||
} else {
|
||||
$stat= "error";
|
||||
}
|
||||
|
||||
my $old_stat=$stat;
|
||||
if ($subcommand eq "off") {
|
||||
$validsub=1;
|
||||
$data = $session->set(new SNMP::Varbind([".".$powerchangeoid,$slot,0,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
$stat = "off";
|
||||
$stat = "off";
|
||||
if ($old_stat eq "off") { $stat .= " $status_noop"; }
|
||||
}
|
||||
if ($subcommand eq "on" or ($subcommand eq "boot" and $stat eq "off")) {
|
||||
$data = $session->set(new SNMP::Varbind([".".$powerchangeoid,$slot,1,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
$stat .= " " . ($data ? "on" : "off");
|
||||
if ($subcommand eq "boot") { $stat .= " " . ($data ? "on" : "off"); }
|
||||
if ($subcommand eq "on") {
|
||||
$stat = ($data ? "on" : "off");
|
||||
if ($old_stat eq "on") { $stat .= " $status_noop"; }
|
||||
}
|
||||
} elsif ($subcommand eq "reset" or ($subcommand eq "boot" and $stat eq "on")) {
|
||||
$data = $session->set(new SNMP::Varbind([".".$powerresetoid,$slot ,1,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
@ -2676,19 +2685,27 @@ sub dompa {
|
||||
$curn = $node;
|
||||
my ($rc,@output) = bladecmd($mpa,$node,$mpahash->{$mpa}->{nodes}->{$node},$mpahash->{$mpa}->{username},$mpahash->{$mpa}->{password},$command,@$args);
|
||||
|
||||
#print "output=@output\n";
|
||||
my $no_op=0;
|
||||
if ($rc) { $no_op=1; }
|
||||
elsif (@output>0) {
|
||||
if ($output[0] =~ /$status_noop/) {
|
||||
$no_op=1;
|
||||
$output[0] =~ s/ $status_noop//; #remove the simbols that meant for use by node statu
|
||||
}
|
||||
}
|
||||
#print "output=@output\n";
|
||||
|
||||
#update the node status
|
||||
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;}
|
||||
}
|
||||
if (($check) && (!$no_op)) {
|
||||
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;}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2728,11 +2745,11 @@ sub dompa {
|
||||
if ($check) {
|
||||
my %node_status=();
|
||||
|
||||
foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
#foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
|
||||
foreach my $node (keys %nodestat) {
|
||||
my $stat=$nodestat{$node};
|
||||
if ($stat eq "error") { next; }
|
||||
if ($stat eq "no-op") { next; }
|
||||
if (exists($node_status{$stat})) {
|
||||
my $pa=$node_status{$stat};
|
||||
push(@$pa, $node);
|
||||
|
@ -90,6 +90,8 @@ use xCAT::data::ipmigenericevents;
|
||||
use xCAT::data::ipmisensorevents;
|
||||
my $cache_version = 2;
|
||||
|
||||
my $status_noop="XXXno-opXXX";
|
||||
|
||||
my %idpxthermbytes = ( #Data to enact the profile quickly
|
||||
'0z' => [0x0A,0x37,0x41,0x3C,0x0a,0x0a,0x1e],
|
||||
'1a' => [0x0A,0x30,0x3C,0x3C,0x0a,0x0a,0x1e],
|
||||
@ -524,7 +526,9 @@ sub ipmicmd {
|
||||
($rc,$text) = power("stat");
|
||||
}
|
||||
elsif($subcommand eq "on") {
|
||||
($rc,$text) = power("on");
|
||||
my ($oldrc,$oldtext) = power("stat");
|
||||
($rc,$text) = power("on");
|
||||
if(($rc == 0) && ($text eq "on") && ($oldtext eq "on")) { $text .= " $status_noop"; }
|
||||
}
|
||||
elsif($subcommand eq "nmi") {
|
||||
($rc,$text) = power("nmi");
|
||||
@ -547,15 +551,19 @@ sub ipmicmd {
|
||||
#
|
||||
# e325 hack end
|
||||
#
|
||||
my ($oldrc,$oldtext) = power("stat");
|
||||
($rc,$text) = power("off");
|
||||
#
|
||||
if(($rc == 0) && ($text eq "off") && ($oldtext eq "off")) { $text .= " $status_noop"; }
|
||||
|
||||
# if($text0 ne "") {
|
||||
# $text = $text0 . " " . $text;
|
||||
# }
|
||||
}
|
||||
elsif($subcommand eq "reset") {
|
||||
my ($oldrc,$oldtext) = power("stat");
|
||||
($rc,$text) = power("reset");
|
||||
$noclose = 0;
|
||||
if(($rc == 0) && ($text eq "off") && ($oldtext eq "off")) { $text .= " $status_noop"; }
|
||||
}
|
||||
elsif($subcommand eq "cycle") {
|
||||
my $text2;
|
||||
@ -5579,7 +5587,7 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
#foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
|
||||
my $children = 0;
|
||||
$SIG{CHLD} = sub {my $kpid; do { $kpid = waitpid(-1, WNOHANG); if ($kpid > 0) { delete $bmc_comm_pids{$kpid}; $children--; } } while $kpid > 0; };
|
||||
@ -5613,13 +5621,13 @@ sub process_request {
|
||||
#update the node status to the nodelist.status table
|
||||
if ($check) {
|
||||
my %node_status=();
|
||||
foreach (keys(%$errornodes)) { $nodestat{$_}="error"; }
|
||||
foreach (keys(%$errornodes)) { $nodestat{$_}="no-op"; }
|
||||
|
||||
foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
#foreach (keys %nodestat) { print "node=$_,status=" . $nodestat{$_} ."\n"; } #Ling:remove
|
||||
|
||||
foreach my $node (keys %nodestat) {
|
||||
my $stat=$nodestat{$node};
|
||||
if ($stat eq "error") { next; }
|
||||
if ($stat eq "no-op") { next; }
|
||||
if (exists($node_status{$stat})) {
|
||||
my $pa=$node_status{$stat};
|
||||
push(@$pa, $node);
|
||||
@ -5650,9 +5658,21 @@ sub forward_data { #unserialize data from pipe, chunk at a time, use magic to de
|
||||
print $rfh "ACK\n";
|
||||
my $responses=thaw($data);
|
||||
foreach (@$responses) {
|
||||
#save the nodes that has errors for node status monitoring
|
||||
if (exists($_->{node}->[0]->{errorcode})) {
|
||||
if ($errornodes) { $errornodes->{$_->{node}->[0]->{name}->[0]}=1; }
|
||||
#save the nodes that has errors and the ones that has no-op for use by the node status monitoring
|
||||
my $no_op=0;
|
||||
if (exists($_->{node}->[0]->{errorcode})) { $no_op=1; }
|
||||
else {
|
||||
my $text=$_->{node}->[0]->{data}->[0]->{contents}->[0];
|
||||
#print "data:$text\n";
|
||||
if (($text) && ($text =~ /$status_noop/)) {
|
||||
$no_op=1;
|
||||
#remove the symbols that meant for use by node status
|
||||
$_->{node}->[0]->{data}->[0]->{contents}->[0] =~ s/ $status_noop//;
|
||||
}
|
||||
}
|
||||
#print "data:". $_->{node}->[0]->{data}->[0]->{contents}->[0] . "\n";
|
||||
if ($no_op) {
|
||||
if ($errornodes) { $errornodes->{$_->{node}->[0]->{name}->[0]}=1; }
|
||||
}
|
||||
$callback->($_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user