2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-24 04:32:04 +00:00

Merge pull request #1429 from xuweibj/powering-on

add powering-on status for PPC-HMC
This commit is contained in:
Xiaopeng Wang 2016-07-01 09:11:10 +08:00 committed by GitHub
commit 05694c1aee
4 changed files with 52 additions and 28 deletions

View File

@ -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]] );
}
#####################################

View File

@ -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 );
}

View File

@ -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);
}
}

View File

@ -3074,7 +3074,6 @@ sub power {
}
$newnodestatus{$newstat}=[$node];
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
unless ($retstring =~ /reset/) {