2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 11:42:05 +00:00

Merge pull request #4727 from whowutwut/support_bootmode

[OpenBMC] Support bootmode generically
This commit is contained in:
Mark Gurevich 2018-01-25 14:29:05 -05:00 committed by GitHub
commit c511982d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 10 deletions

View File

@ -63,6 +63,10 @@ OpenBMC specific:
\ **rspconfig**\ \ *noderange*\ \ **autoreboot={0|1}**\
\ **rspconfig**\ \ *noderange*\ \ **bootmode**\
\ **rspconfig**\ \ *noderange*\ \ **bootmode={safe|regular|setup}**\
MPA specific:
=============
@ -462,6 +466,12 @@ OPTIONS
\ **bootmode**\
Display or control BMC Boot Mode attribute setting.
\ **dump**\
Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump.

View File

@ -40,6 +40,10 @@ B<rspconfig> I<noderange> B<autoreboot>
B<rspconfig> I<noderange> B<autoreboot={0|1}>
B<rspconfig> I<noderange> B<bootmode>
B<rspconfig> I<noderange> B<bootmode={safe|regular|setup}>
=head2 MPA specific:
B<rspconfig> I<noderange> {B<sshcfg>|B<snmpcfg>|B<pd1>|B<pd2>|B<network>|B<swnet>|B<ntp>|B<textid>|B<frame>}
@ -350,6 +354,10 @@ Display or control BMC Power Supply Redundancy attribute setting.
Display or control BMC Auto Reboot attribute setting.
=item B<bootmode>
Display or control BMC Boot Mode attribute setting.
=item B<dump>
Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump.

View File

@ -596,13 +596,27 @@ my %api_config_info = (
type => "boolean",
subcommand => "autoreboot",
},
RSPCONFIG_BOOT_MODE => {
command => "rspconfig",
url => "/control/host0/boot",
attr_url => "BootMode",
display_name => "BMC BootMode",
instruct_msg => "",
type => "attribute",
subcommand => "bootmode",
attr_value => {
regular => "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular",
safe => "xyz.openbmc_project.Control.Boot.Mode.Modes.Safe",
setup => "xyz.openbmc_project.Control.Boot.Mode.Modes.Setup",
},
},
RSPCONFIG_POWERSUPPLY_REDUNDANCY => {
command => "rspconfig",
url => "/sensors/chassis/PowerSupplyRedundancy",
attr_url => "/action/setValue",
query_url => "/action/getValue",
display_name => "BMC PowerSupplyRedundancy",
instruct_msg => "bmc reboot is required",
instruct_msg => "",
type => "action_attribute",
subcommand => "powersupplyredundancy",
attr_value => {
@ -1171,7 +1185,7 @@ sub parse_args {
my $all_subcommand = "";
foreach $subcommand (@ARGV) {
$::RSPCONFIG_CONFIGURED_API_KEY = &is_valid_config_api($subcommand, $callback);
if ($::RSPCONFIG_CONFIGURED_API_KEY != -1) {
if ($::RSPCONFIG_CONFIGURED_API_KEY ne -1) {
# subcommand defined in the configured API hash, return from here, the RSPCONFIG_CONFIGURED_API_KEY is the key into the hash
return;
}
@ -1574,7 +1588,7 @@ sub parse_command_status {
my @options = ();
my $num_subcommand = @$subcommands;
#Setup chain to process the configured command
if ($::RSPCONFIG_CONFIGURED_API_KEY != -1) {
if ($::RSPCONFIG_CONFIGURED_API_KEY ne -1) {
$subcommand = $$subcommands[0];
# Check if setting or quering
if ($subcommand =~ /^(\w+)=(.*)/) {
@ -3609,16 +3623,15 @@ sub rspconfig_api_config_response {
# For example "xyz.openbmc_project.Control.Power.RestorePolicy.Policy.Restore"
# will be displayed as "Restore"
my @attr_value = split('\.', $value);
my $last_component = @attr_value[-1];
my $last_component = $attr_value[-1];
my @valid_values = values $api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{attr_value};
if ($value) {
if ($value ~~ @valid_values) {
# Received one of the expected values (defined in attr_value hash for this command
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
} else {
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
my $found = grep(/$value/, @valid_values);
if ($found eq 0) {
# Received data value not expected
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
xCAT::SvrUtils::sendmsg("Warning: Unexpected value set. Valid values: " . join(",", @valid_values), $callback, $node);
xCAT::SvrUtils::sendmsg("WARNING: Unexpected value set: $value", $callback, $node);
xCAT::SvrUtils::sendmsg("WARNING: Valid values: " . join(",", @valid_values), $callback, $node);
}
}
else {