diff --git a/perl-xCAT/xCAT/PPCboot.pm b/perl-xCAT/xCAT/PPCboot.pm index 1f5b9e776..1c58f559e 100644 --- a/perl-xCAT/xCAT/PPCboot.pm +++ b/perl-xCAT/xCAT/PPCboot.pm @@ -596,6 +596,10 @@ sub rnetboot { # ##################################### if ( $data =~ /Finished/) { + my $newstat = $::STATUS_POWERING_ON; + my %newnodestatus=(); + $newnodestatus{$newstat}=[$node]; + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); return( [[$node,"Success",$Rc]] ); } ##################################### diff --git a/perl-xCAT/xCAT/PPCpower.pm b/perl-xCAT/xCAT/PPCpower.pm index a37453305..0ee082f51 100644 --- a/perl-xCAT/xCAT/PPCpower.pm +++ b/perl-xCAT/xCAT/PPCpower.pm @@ -8,6 +8,9 @@ use xCAT::Usage; use xCAT::MsgUtils; use xCAT::FSPpower; +use xCAT::GlobalDef; +use xCAT_monitoring::monitorctrl; + ########################################################################## # Parse the command line for options and operands ########################################################################## @@ -183,6 +186,9 @@ sub powercmd_boot { my $Rc = shift(@$stat); my $data = @$stat[0]; + my $newstat; + my %newnodestatus = (); + while (my ($name,$d) = each(%$hash) ) { ################################## # Look up by lparid @@ -197,6 +203,7 @@ sub powercmd_boot { push @output, [$name,$data,$Rc]; next; } + ################################## # Node not found ################################## @@ -210,6 +217,10 @@ sub powercmd_boot { my $state = power_status($data->{$id}); my $op = ($state =~ /^off$/) ? "on" : "reset"; + if ($state =~ /^off$/) { + $newstat = $::STATUS_POWERING_ON; + } + # Attribute powerinterval in site table, # to control the rpower forking speed if ((defined($request->{op})) && ($request->{op} ne 'stat') && ($request->{op} ne 'status') @@ -225,6 +236,9 @@ sub powercmd_boot { $exp, $op, $d ); + unless (@$result[0] != SUCCESS) { + $newnodestatus{$newstat}=[$name] if ($newstat); + } push @output, [$name,@$result[1],@$result[0]]; } if (defined($request->{opt}->{m})) { @@ -283,6 +297,8 @@ sub powercmd_boot { } } } + + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); return( \@output ); } @@ -298,6 +314,14 @@ sub powercmd { my @result = (); my $callback = $request->{'callback'}; + my ($name) = keys %$hash; + my $mtms = @{$hash->{$name}}[2]; + my $stat = enumerate( $exp, $hash, $mtms ); + my $Rc = shift(@$stat); + my $data = @$stat[0]; + + my $newstat; + my %newnodestatus=(); #################################### # Power commands are grouped by CEC @@ -305,6 +329,7 @@ sub powercmd { #################################### while (my ($name,$d) = each(%$hash) ) { + $newstat = ""; # Attribute powerinterval in site table, # to control the rpower forking speed if ((defined($request->{op})) && ($request->{op} ne 'stat') && ($request->{op} ne 'status') @@ -313,6 +338,21 @@ sub powercmd { Time::HiRes::sleep($request->{'powerinterval'}); } } + if (($request->{op} eq 'off') || ($request->{op} ne 'softoff')) { + $newstat = $::STATUS_POWERING_OFF; + } + if ($request->{op} eq 'on') { + $newstat = $::STATUS_POWERING_ON; + } + + if ($request->{op} eq 'reset') { + my $type = @$d[4]; + my $id = ($type=~/^(fsp|bpa|frame|cec)$/) ? $type : @$d[0]; + my $state = power_status($data->{$id}); + if ($state !~ /^off$/) { + $newstat = $::STATUS_POWERING_ON; + } + } ################################ # Send command to each LPAR ################################ @@ -320,7 +360,13 @@ sub powercmd { $exp, $request->{op}, $d ); - my $Rc = shift(@$values); + my $Rc = shift(@$values); + + unless ($Rc != SUCCESS) { + if ($newstat) { + $newnodestatus{$newstat}=[$name]; + } + } ################################ # Return result @@ -371,6 +417,7 @@ sub powercmd { } } } + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); return( \@result ); } diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index afd458a39..347a1aef6 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -250,32 +250,6 @@ sub process_command { } } #print "oldstatus:" . Dumper(\%oldnodestatus); - - #set the new status to the nodelist.status - my %newnodestatus=(); - my $newstat; - if (($subcommand eq 'off') || ($subcommand eq 'softoff')) { - my $newstat=$::STATUS_POWERING_OFF; - $newnodestatus{$newstat}=\@allnodes; - } else { - #get the current nodeset stat - if (@allnodes>0) { - my $nsh={}; - my ($ret, $msg)=xCAT::SvrUtils->getNodesetStates(\@allnodes, $nsh); - if (!$ret) { - foreach (keys %$nsh) { - my $newstat=xCAT_monitoring::monitorctrl->getNodeStatusFromNodesetState($_, $command); - $newnodestatus{$newstat}=$nsh->{$_}; - } - } else { - trace( $request, $msg ); - } - } - } - #donot update node provision status (installing or netbooting) here - xCAT::Utils->filter_nostatusupdate(\%newnodestatus); - #print "newstatus" . Dumper(\%newnodestatus); - xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); } } diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 50e2d40d0..52260c41b 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -3074,7 +3074,6 @@ sub power { } $newnodestatus{$newstat}=[$node]; - xCAT::Utils->filter_nostatusupdate(\%newnodestatus); xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); unless ($retstring =~ /reset/) {