Skip to content

Commit 192f3da

Browse files
committed
fix: support idrac10 quirks + lenovo bios bug fix
Signed-off-by: Krish Dandiwala <kdandiwala@nvidia.com>
1 parent 23d4f77 commit 192f3da

3 files changed

Lines changed: 39 additions & 14 deletions

File tree

src/dell.rs

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,11 +1082,12 @@ impl Bmc {
10821082
expected_attrs.con_term_type,
10831083
dell::SerialPortTermSettings
10841084
);
1085-
diff!(
1086-
"RedirAfterBoot",
1087-
expected_attrs.redir_after_boot,
1088-
EnabledDisabled
1089-
);
1085+
// Only available in iDRAC 9
1086+
if let (Some(exp), Some(_)) =
1087+
(expected_attrs.redir_after_boot, bios.get("RedirAfterBoot"))
1088+
{
1089+
diff!("RedirAfterBoot", exp, EnabledDisabled);
1090+
}
10901091
diff!(
10911092
"SriovGlobalEnable",
10921093
expected_attrs.sriov_global_enable,
@@ -1126,11 +1127,14 @@ impl Bmc {
11261127
("OS-BMC.1.AdminState", "Disabled"),
11271128
]);
11281129
for (key, exp) in expected {
1129-
let Some(act) = manager_attrs.get(key) else {
1130-
return Err(RedfishError::MissingKey {
1130+
let act = match manager_attrs.get(key) {
1131+
Some(v) => v,
1132+
// Only available in iDRAC 9, skip if it doesn't exist
1133+
None if key == "OS-BMC.1.AdminState" => continue,
1134+
None => return Err(RedfishError::MissingKey {
11311135
key: key.to_string(),
11321136
url: "Managers/{manager_id}/Oem/Dell/DellAttributes/{manager_id}".to_string(),
1133-
});
1137+
}),
11341138
};
11351139
if act != exp {
11361140
diffs.push(MachineSetupDiff {
@@ -1591,12 +1595,18 @@ impl Bmc {
15911595
let manager_id = self.s.manager_id();
15921596
let url = format!("Managers/{manager_id}/Oem/Dell/DellAttributes/{manager_id}");
15931597

1598+
let current_attrs = self.manager_dell_oem_attributes().await?;
1599+
15941600
let mut attributes = HashMap::new();
15951601
// racadm set idrac.webserver.HostHeaderCheck 0
15961602
attributes.insert("WebServer.1.HostHeaderCheck", "Disabled".to_string());
15971603
// racadm set iDRAC.IPMILan.Enable 1
15981604
attributes.insert("IPMILan.1.Enable", "Enabled".to_string());
1599-
attributes.insert("OS-BMC.1.AdminState", "Disabled".to_string());
1605+
1606+
// Only available in iDRAC 9
1607+
if current_attrs.get("OS-BMC.1.AdminState").is_some() {
1608+
attributes.insert("OS-BMC.1.AdminState", "Disabled".to_string());
1609+
}
16001610

16011611
let body = HashMap::from([("Attributes", attributes)]);
16021612
self.s.client.patch(&url, body).await?;
@@ -1697,21 +1707,34 @@ impl Bmc {
16971707
.collect();
16981708
let boot_options_to_disable_str = boot_options_to_disable_arr.join(",");
16991709

1710+
// RedirAfterBoot: Not available in iDRAC 10
1711+
let redir_after_boot = curr_bios_attributes
1712+
.get("RedirAfterBoot")
1713+
.is_some()
1714+
.then_some(EnabledDisabled::Enabled);
1715+
1716+
// BootMode: Read-only in iDRAC 10 (UEFI-only hardware), writable in iDRAC 9
1717+
let boot_mode = match curr_bios_attributes.get("BootMode").and_then(|v| v.as_str()) {
1718+
Some("Uefi") => None, // Already correct, don't touch it
1719+
Some(_) => Some("Uefi".to_string()), // Try to fix it (iDRAC 9)
1720+
None => None, // Attribute doesn't exist
1721+
};
1722+
17001723
Ok(dell::MachineBiosAttrs {
17011724
in_band_manageability_interface: EnabledDisabled::Disabled,
17021725
uefi_variable_access: dell::UefiVariableAccessSettings::Standard,
17031726
serial_comm: dell::SerialCommSettings::OnConRedir,
17041727
serial_port_address: dell::SerialPortSettings::Com1,
17051728
fail_safe_baud: "115200".to_string(),
17061729
con_term_type: dell::SerialPortTermSettings::Vt100Vt220,
1707-
redir_after_boot: EnabledDisabled::Enabled,
1730+
redir_after_boot,
17081731
sriov_global_enable: EnabledDisabled::Enabled,
17091732
tpm_security: OnOff::On,
17101733
tpm2_hierarchy: dell::Tpm2HierarchySettings::Clear,
17111734
tpm2_algorithm: dell::Tpm2Algorithm::SHA256,
17121735
http_device_1_enabled_disabled: EnabledDisabled::Enabled,
17131736
pxe_device_1_enabled_disabled: EnabledDisabled::Disabled,
1714-
boot_mode: "Uefi".to_string(),
1737+
boot_mode,
17151738
http_device_1_interface: nic_slot.to_string(),
17161739
set_boot_order_en: nic_slot.to_string(),
17171740
http_device_1_tls_mode: dell::TlsMode::None,

src/lenovo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl Redfish for Bmc {
393393
);
394394
attributes.insert(
395395
"DevicesandIOPorts_SerialPortAccessMode",
396-
EnabledDisabled::Enabled.to_string(),
396+
"Shared".to_string(),
397397
);
398398

399399
// Only in older Lenovo systems

src/model/oem/dell.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,14 @@ pub struct MachineBiosAttrs {
246246
pub serial_port_address: SerialPortSettings,
247247
pub fail_safe_baud: String,
248248
pub con_term_type: SerialPortTermSettings,
249-
pub redir_after_boot: EnabledDisabled,
249+
#[serde(skip_serializing_if = "Option::is_none")]
250+
pub redir_after_boot: Option<EnabledDisabled>,
250251
pub sriov_global_enable: EnabledDisabled,
251252
pub tpm_security: OnOff,
252253
pub tpm2_hierarchy: Tpm2HierarchySettings,
253254
pub tpm2_algorithm: Tpm2Algorithm,
254-
pub boot_mode: String,
255+
#[serde(skip_serializing_if = "Option::is_none")]
256+
pub boot_mode: Option<String>,
255257
#[serde(rename = "HttpDev1EnDis")]
256258
pub http_device_1_enabled_disabled: EnabledDisabled,
257259
#[serde(rename = "PxeDev1EnDis")]

0 commit comments

Comments
 (0)