Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ authors = ["NVIDIA Carbide Engineering <carbide-dev@exchange.nvidia.com>"]

[workspace.dependencies]
clap = { version = "4", features = ["derive", "env"] }
libredfish = { git = "https://github.com/NVIDIA/libredfish.git", tag = "v0.43.2" }
libredfish = { git = "https://github.com/kdhulipala-wq/libredfish.git", branch = "prints" }
librms = { git = "https://github.com/NVIDIA/nv-rms-client.git", tag = "v0.0.5" }
ansi-to-html = "0.2.2"

Expand Down
33 changes: 32 additions & 1 deletion crates/api-model/src/machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,10 @@ pub enum MachineState {
Init,
EnableIpmiOverLan,
WaitingForPlatformConfiguration,
/// Wait for BIOS config job (Dell) to complete before PollingBiosSetup / SetBootOrder.
WaitingForBiosJob {
bios_config_info: BiosConfigInfo,
},
PollingBiosSetup,
SetBootOrder {
set_boot_order_info: Option<SetBootOrderInfo>,
Expand Down Expand Up @@ -1729,6 +1733,29 @@ pub enum UefiSetupState {
LockdownHost,
}

/// Tracks progress waiting for the Dell BIOS config job (from machine_setup PATCH) to complete
/// before configuring boot order. Same pattern as SetBootOrderInfo / SetBootOrderState.
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
pub struct BiosConfigInfo {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bios_job_id: Option<String>,
pub bios_config_state: BiosConfigState,
}
Comment on lines +1740 to +1744
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add retry_count here and check against it in the state transitions or else we could infinite loop if the job keeps failing, even with the remediation. I think the boot order states already do this.


#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, EnumIter)]
#[serde(tag = "state", rename_all = "lowercase")]
pub enum BiosConfigState {
WaitForBiosJobScheduled,
RebootHost,
WaitForBiosJobCompletion,
/// Power off → BMC reset → power on when job fails or is scheduled with errors (same as boot order).
HandleBiosJobFailure {
failure: String,
power_state: PowerState,
},
}
Comment on lines +1748 to +1757
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

advance_bios_config_job is essentially a duplicate of the states in set_host_boot_order. Not sure if you want to rework this PR to do the following but it can be a follow-up to extract a shared RedfishJobInfo / RedfishJobState that both paths delegate to:

pub struct RedfishJobInfo {
    pub job_id: Option<String>,
    pub redfish_job_state: RedfishJobState,
    pub retry_count: u32,  // BiosConfigInfo is missing this rn which we need to avoid an infinite loop
}

pub enum RedfishJobState {
    WaitForJobScheduled,
    RebootHost,
    WaitForJobCompletion,
    HandleJobFailure { failure: String, power_state: PowerState },
}

Then one shared handler that replaces both advance_bios_config_job and the four job-waiting arms in set_host_boot_order:

enum RedfishJobAdvance {
    Continue(RedfishJobInfo),
    Done,
    Wait(String),
}
async fn advance_redfish_job(
    ctx, redfish_client, mh_snapshot,
    job: RedfishJobInfo,
    label: &str,  // "BIOS config" / "SetBootOrder" for log messages
) -> Result<RedfishJobAdvance, StateHandlerError> { ... }


#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
pub struct SetBootOrderInfo {
Expand Down Expand Up @@ -1892,7 +1919,11 @@ pub enum HostPlatformConfigurationState {
},
CheckHostConfig,
UnlockHost,
ConfigureBios,
/// When bios_config_info is Some, we are waiting for the BIOS job to complete (Dell).
ConfigureBios {
#[serde(default, skip_serializing_if = "Option::is_none")]
bios_config_info: Option<BiosConfigInfo>,
},
PollingBiosSetup,
SetBootOrder {
set_boot_order_info: SetBootOrderInfo,
Expand Down
Loading