mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
Merge pull request #4727 from whowutwut/support_bootmode
[OpenBMC] Support bootmode generically
This commit is contained in:
commit
c511982d5b
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user