From 1819417f1842489420f0a02e70d91394333683ce Mon Sep 17 00:00:00 2001 From: Reuben Elliott Date: Wed, 15 Jul 2026 18:54:19 +0100 Subject: [PATCH 1/3] Add BIOS reset command to admin cli Signed-off-by: Reuben Elliott --- crates/admin-cli/src/redfish/args.rs | 19 +++++++ crates/admin-cli/src/redfish/cmds.rs | 8 +++ crates/admin-cli/src/redfish/tests.rs | 27 ++++++++++ .../commands/redfish/redfish-reset-bios.md | 53 +++++++++++++++++++ .../commands/redfish/redfish.md | 1 + 5 files changed, 108 insertions(+) create mode 100644 docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md diff --git a/crates/admin-cli/src/redfish/args.rs b/crates/admin-cli/src/redfish/args.rs index 5b6d18bec9..bb34a99ee0 100644 --- a/crates/admin-cli/src/redfish/args.rs +++ b/crates/admin-cli/src/redfish/args.rs @@ -231,6 +231,19 @@ Clear the UEFI password (supply the current one): ClearNvram, /// Set BIOS options SetBios(SetBios), + /// Reset BIOS settings to factory defaults + #[command(after_long_help = "\ +EXAMPLES: + +Reset BIOS settings to factory defaults: + $ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios + +Reset BIOS settings and restart the system to apply the change: + $ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword \ + reset-bios --reboot + +")] + ResetBios(ResetBiosArgs), /// Get DPU mode GetNicMode, /// Is infinite boot enable @@ -524,6 +537,12 @@ pub struct MachineSetupStatusArgs { pub boot_interface_mac: Option, } +#[derive(Parser, Debug, PartialEq, Clone)] +pub struct ResetBiosArgs { + #[clap(short, long, help = "Restart the system to apply the BIOS reset")] + pub reboot: bool, +} + #[derive(Parser, Debug, PartialEq, Clone)] pub struct SetBootOrderDpuFirstArgs { #[clap(long, help = "boot_interface_mac")] diff --git a/crates/admin-cli/src/redfish/cmds.rs b/crates/admin-cli/src/redfish/cmds.rs index 0fd8123b5c..4d162255c1 100644 --- a/crates/admin-cli/src/redfish/cmds.rs +++ b/crates/admin-cli/src/redfish/cmds.rs @@ -476,6 +476,14 @@ pub async fn action(action: RedfishAction) -> color_eyre::Result<()> { redfish.set_bios(attrmap).await?; println!("success"); } + ResetBios(args) => { + redfish.reset_bios().await?; + if args.reboot { + redfish.power(SystemPowerControl::ForceRestart).await?; + } else { + println!("BIOS changes require a system restart to take effect."); + } + } GetNicMode => { let is_dpu_in_nic_mode = redfish.get_nic_mode().await?; println!("{is_dpu_in_nic_mode:#?}"); diff --git a/crates/admin-cli/src/redfish/tests.rs b/crates/admin-cli/src/redfish/tests.rs index d179d02ac8..37bb510565 100644 --- a/crates/admin-cli/src/redfish/tests.rs +++ b/crates/admin-cli/src/redfish/tests.rs @@ -173,6 +173,33 @@ fn parse_create_bmc_user() { ); } +#[test] +fn parse_reset_bios() { + scenarios!( + run = |argv| { + RedfishAction::try_parse_from(argv.iter().copied()) + .map(|a| match a.command { + Cmd::ResetBios(args) => args.reboot, + _ => panic!("expected ResetBios variant"), + }) + .map_err(drop) + }; + "without reboot" { + &["redfish", "--address", "192.0.2.10", "reset-bios"][..] => Yields(false), + } + + "with reboot" { + &[ + "redfish", + "--address", + "192.0.2.10", + "reset-bios", + "--reboot", + ][..] => Yields(true), + } + ); +} + // `dpu firmware status` parses through the nested DpuOperations / FwCommand // subcommands to the Dpu Firmware Status variant. #[test] diff --git a/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md new file mode 100644 index 0000000000..f4484f0993 --- /dev/null +++ b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md @@ -0,0 +1,53 @@ +# `nico-admin-cli redfish reset-bios` + +_[Hardware commands](../../hardware.md) › [redfish](./redfish.md) › **reset-bios**_ + +## NAME + +nico-admin-cli-redfish-reset-bios - Reset BIOS settings to factory +defaults + +## SYNOPSIS + +**nico-admin-cli redfish reset-bios** \[**-r**\|**--reboot**\] +\[**--extended**\] \[**--sort-by**\] \[**-h**\|**--help**\] + +## DESCRIPTION + +Reset BIOS settings to factory defaults + +## OPTIONS + +**-r**, **--reboot** +Restart the system to apply the BIOS reset + +**--extended** +Extended result output. + +This used by measured boot, where basic output contains just what you +probably care about, and "extended" output also dumps out all the +internal UUIDs that are used to associate instances. + +**--sort-by** *\* \[default: primary-id\] +Sort output by specified field\ + +\ +*Possible values:* + +- primary-id: Sort by the primary id + +- state: Sort by state + +**-h**, **--help** +Print help (see a summary with -h) + +## Examples + +```sh +nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios +nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios --reboot +``` + +--- + +**See also:** [Hardware commands](../../hardware.md) · [CLI reference index](../../README.md) diff --git a/docs/manuals/nico-admin-cli/commands/redfish/redfish.md b/docs/manuals/nico-admin-cli/commands/redfish/redfish.md index 384aeb226e..0d3ba24f31 100644 --- a/docs/manuals/nico-admin-cli/commands/redfish/redfish.md +++ b/docs/manuals/nico-admin-cli/commands/redfish/redfish.md @@ -117,6 +117,7 @@ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypasswo | [`get-base-mac-address`](./redfish-get-base-mac-address.md) | Get Base Mac Address (DPU only) | | [`clear-nvram`](./redfish-clear-nvram.md) | Clear Nvram (Viking only) | | [`set-bios`](./redfish-set-bios.md) | Set BIOS options | +| [`reset-bios`](./redfish-reset-bios.md) | Reset BIOS settings to factory defaults | | [`get-nic-mode`](./redfish-get-nic-mode.md) | Get DPU mode | | [`is-infinite-boot-enabled`](./redfish-is-infinite-boot-enabled.md) | Is infinite boot enable | | [`enable-infinite-boot`](./redfish-enable-infinite-boot.md) | Enable infinite boot | From 971509b241d96096493782676ea7466dd96fb6f9 Mon Sep 17 00:00:00 2001 From: Reuben Elliott Date: Wed, 15 Jul 2026 19:31:11 +0100 Subject: [PATCH 2/3] address coderabbit comments Signed-off-by: Reuben Elliott --- crates/admin-cli/src/redfish/args.rs | 10 ++++++++-- .../commands/redfish/redfish-reset-bios.md | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crates/admin-cli/src/redfish/args.rs b/crates/admin-cli/src/redfish/args.rs index bb34a99ee0..fd43d1802e 100644 --- a/crates/admin-cli/src/redfish/args.rs +++ b/crates/admin-cli/src/redfish/args.rs @@ -231,7 +231,9 @@ Clear the UEFI password (supply the current one): ClearNvram, /// Set BIOS options SetBios(SetBios), - /// Reset BIOS settings to factory defaults + /// Reset BIOS settings to factory defaults. Returns once the BMC accepts + /// the reset request. A system restart is required for the settings to + /// take effect. #[command(after_long_help = "\ EXAMPLES: @@ -539,7 +541,11 @@ pub struct MachineSetupStatusArgs { #[derive(Parser, Debug, PartialEq, Clone)] pub struct ResetBiosArgs { - #[clap(short, long, help = "Restart the system to apply the BIOS reset")] + #[clap( + short, + long, + help = "Perform a forced restart after the BMC accepts the BIOS reset request" + )] pub reboot: bool, } diff --git a/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md index f4484f0993..b25d946a95 100644 --- a/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md +++ b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md @@ -10,16 +10,18 @@ defaults ## SYNOPSIS **nico-admin-cli redfish reset-bios** \[**-r**\|**--reboot**\] -\[**--extended**\] \[**--sort-by**\] \[**-h**\|**--help**\] +\[**--extended**\] \[**--sort-by** *\*\] \[**-h**\|**--help**\] ## DESCRIPTION -Reset BIOS settings to factory defaults +Reset BIOS settings to factory defaults. Returns once the BMC accepts +the reset request. A system restart is required for the settings to take +effect. ## OPTIONS **-r**, **--reboot** -Restart the system to apply the BIOS reset +Perform a forced restart after the BMC accepts the BIOS reset request **--extended** Extended result output. From 5cd9ed2433def6df8b48685bfa561fa839d0dcb3 Mon Sep 17 00:00:00 2001 From: Reuben Elliott Date: Thu, 16 Jul 2026 09:14:23 +0100 Subject: [PATCH 3/3] Update docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md Co-authored-by: Bill Minckler Signed-off-by: Reuben Elliott --- .../nico-admin-cli/commands/redfish/redfish-reset-bios.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md index b25d946a95..50b4d7810d 100644 --- a/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md +++ b/docs/manuals/nico-admin-cli/commands/redfish/redfish-reset-bios.md @@ -26,7 +26,7 @@ Perform a forced restart after the BMC accepts the BIOS reset request **--extended** Extended result output. -This used by measured boot, where basic output contains just what you +This is used by measured boot, where basic output contains just what you probably care about, and "extended" output also dumps out all the internal UUIDs that are used to associate instances.