diff --git a/docs/source/guides/admin-guides/references/man1/rpower.1.rst b/docs/source/guides/admin-guides/references/man1/rpower.1.rst index 535687134..1dee1d74a 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -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. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 4ca8093c0..f69ce7dab 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -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 [boot] [ -c ] PPC (with IVM or HMC) specific: diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index 4939196db..2c5683fb1 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -22,7 +22,7 @@ B I [B|B|B|B] =head2 OpenPOWER OpenBMC: -B I [B|B|B|B|B|B|B|B|B] +B I [B|B|B|B|B|B|B|B|B|B] =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 + +To reboot BMC. + =item B To get state of the BMC. diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 6cf6529d8..5f1717548 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -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]; } }