diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index f8d9e8b85..118a39de1 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -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. diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index 2f72806f2..c75d8dae7 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -40,6 +40,10 @@ B I B B I B +B I B + +B I B + =head2 MPA specific: B I {B|B|B|B|B|B|B|B|B} @@ -350,6 +354,10 @@ Display or control BMC Power Supply Redundancy attribute setting. Display or control BMC Auto Reboot attribute setting. +=item B + +Display or control BMC Boot Mode attribute setting. + =item B Manage OpenBMC system dumps. If no sub-option is provided, will generate, wait, and download the dump. diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 87a979061..3a6a3514c 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -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 {