mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-03 10:07:36 +00:00
Merge pull request #3438 from xuweibj/I3436
Add rpower bmcreboot command for openbmc
This commit is contained in:
@@ -45,7 +45,7 @@ OpenPOWER OpenBMC:
|
||||
==================
|
||||
|
||||
|
||||
\ **rpower**\ \ *noderange*\ [\ **off | on | softoff | reset | boot | bmcstate | stat | state | status**\ ]
|
||||
\ **rpower**\ \ *noderange*\ [\ **off | on | softoff | reset | boot | bmcreboot | bmcstate | stat | state | status**\ ]
|
||||
|
||||
|
||||
PPC (with IVM or HMC) specific:
|
||||
@@ -380,6 +380,12 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
\ **bmcreboot**\
|
||||
|
||||
To reboot BMC.
|
||||
|
||||
|
||||
|
||||
\ **bmcstate**\
|
||||
|
||||
To get state of the BMC.
|
||||
|
@@ -29,10 +29,10 @@ my %usage = (
|
||||
rpower noderange [on|off|softoff|reset|boot|stat|state|status|wake|suspend [-w timeout] [-o] [-r]]
|
||||
rpower noderange [pduon|pduoff|pdustat]
|
||||
OpenPOWER BMC:
|
||||
rpower noderange [on|off|softoff|reset|boot|bmcstate|stat|state|status]
|
||||
rpower noderange [on|off|reset|boot|stat|state|status]
|
||||
rpower noderange [pduon|pduoff|pdustat]
|
||||
OpenPOWER OpenBMC:
|
||||
rpower noderange [on|off|reset|boot|stat|state|status]
|
||||
rpower noderange [on|off|softoff|reset|boot|bmcreboot|bmcstate|stat|state|status]
|
||||
KVM Virtualization specific:
|
||||
rpower <noderange> [boot] [ -c <path to iso> ]
|
||||
PPC (with IVM or HMC) specific:
|
||||
|
@@ -22,7 +22,7 @@ B<rpower> I<noderange> [B<pduon>|B<pduoff>|B<pdustat>|B<pdureset>]
|
||||
|
||||
=head2 OpenPOWER OpenBMC:
|
||||
|
||||
B<rpower> I<noderange> [B<off>|B<on>|B<softoff>|B<reset>|B<boot>|B<bmcstate>|B<stat>|B<state>|B<status>]
|
||||
B<rpower> I<noderange> [B<off>|B<on>|B<softoff>|B<reset>|B<boot>|B<bmcreboot>|B<bmcstate>|B<stat>|B<state>|B<status>]
|
||||
|
||||
=head2 PPC (with IVM or HMC) specific:
|
||||
|
||||
@@ -247,6 +247,10 @@ To pause all processes in the instance.
|
||||
|
||||
To unpause all processes in the instance.
|
||||
|
||||
=item B<bmcreboot>
|
||||
|
||||
To reboot BMC.
|
||||
|
||||
=item B<bmcstate>
|
||||
|
||||
To get state of the BMC.
|
||||
|
@@ -31,12 +31,13 @@ use xCAT_monitoring::monitorctrl;
|
||||
|
||||
$::VERBOSE = 0;
|
||||
# String constants for rpower states
|
||||
$::POWER_STATE_OFF="off";
|
||||
$::POWER_STATE_ON="on";
|
||||
$::POWER_STATE_POWERING_OFF="powering-off";
|
||||
$::POWER_STATE_POWERING_ON="powering-on";
|
||||
$::POWER_STATE_QUIESCED="quiesced";
|
||||
$::POWER_STATE_RESET="reset";
|
||||
$::POWER_STATE_OFF = "off";
|
||||
$::POWER_STATE_ON = "on";
|
||||
$::POWER_STATE_POWERING_OFF = "powering-off";
|
||||
$::POWER_STATE_POWERING_ON = "powering-on";
|
||||
$::POWER_STATE_QUIESCED = "quiesced";
|
||||
$::POWER_STATE_RESET = "reset";
|
||||
$::POWER_STATE_REBOOT = "reboot";
|
||||
$::UPLOAD_FILE="";
|
||||
|
||||
$::NO_ATTRIBUTES_RETURNED="No attributes returned from the BMC.";
|
||||
@@ -152,6 +153,11 @@ my %status_info = (
|
||||
process => \&rinv_response,
|
||||
},
|
||||
|
||||
RPOWER_BMCREBOOT_REQUEST => {
|
||||
method => "PUT",
|
||||
init_url => "$openbmc_project_url/state/bmc0/attr/RequestedBMCTransition",
|
||||
data => "xyz.openbmc_project.State.BMC.Transition.Reboot",
|
||||
},
|
||||
RPOWER_ON_REQUEST => {
|
||||
method => "PUT",
|
||||
init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition",
|
||||
@@ -455,7 +461,7 @@ sub parse_args {
|
||||
}
|
||||
|
||||
if ($command eq "rpower") {
|
||||
unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcstate$|^status$|^stat$|^state$/) {
|
||||
unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcreboot$|^bmcstate$|^status$|^stat$|^state$/) {
|
||||
return ([ 1, "Unsupported command: $command $subcommand" ]);
|
||||
}
|
||||
} elsif ($command eq "rinv") {
|
||||
@@ -602,6 +608,10 @@ sub parse_command_status {
|
||||
$next_status{RPOWER_ON_REQUEST} = "RPOWER_ON_RESPONSE";
|
||||
$next_status{RPOWER_STATUS_RESPONSE}{ON} = "RPOWER_RESET_REQUEST";
|
||||
$next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE";
|
||||
} elsif ($subcommand eq "bmcreboot") {
|
||||
$next_status{LOGIN_RESPONSE} = "RPOWER_BMCREBOOT_REQUEST";
|
||||
$next_status{RPOWER_BMCREBOOT_REQUEST} = "RPOWER_RESET_RESPONSE";
|
||||
$status_info{RPOWER_RESET_RESPONSE}{argv} = "$subcommand";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1045,7 +1055,12 @@ sub rpower_response {
|
||||
|
||||
if ($node_info{$node}{cur_status} eq "RPOWER_RESET_RESPONSE") {
|
||||
if ($response_info->{'message'} eq $::RESPONSE_OK) {
|
||||
xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node);
|
||||
if (defined $status_info{RPOWER_RESET_RESPONSE}{argv} and $status_info{RPOWER_RESET_RESPONSE}{argv} =~ /bmcreboot$/) {
|
||||
my $bmc_node = "$node BMC";
|
||||
xCAT::SvrUtils::sendmsg("$::POWER_STATE_REBOOT", $callback, $bmc_node);
|
||||
} else {
|
||||
xCAT::SvrUtils::sendmsg("$::POWER_STATE_RESET", $callback, $node);
|
||||
}
|
||||
$new_status{$::STATUS_POWERING_ON} = [$node];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user