Add backend SMBios support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-22 21:13:00 +02:00
parent 94ee8f8c78
commit 644fd6f1bb
2 changed files with 58 additions and 0 deletions

View File

@ -83,6 +83,8 @@ pub struct VMInfo {
pub networks: Vec<Network>,
/// Add a TPM v2.0 module
pub tpm_module: bool,
/// Strings injected as OEM Strings in SMBios configuration
pub oem_strings: Vec<String>,
}
impl VMInfo {
@ -329,6 +331,9 @@ impl VMInfo {
BootType::UEFISecureBoot => "yes".to_string(),
},
}),
smbios: Some(OSSMBiosXML {
mode: "sysinfo".to_string(),
}),
},
features: FeaturesXML { acpi: ACPIXML {} },
@ -385,6 +390,17 @@ impl VMInfo {
}),
},
sysinfo: Some(SysInfoXML {
r#type: "smbios".to_string(),
oem_strings: Some(OEMStringsXML {
entries: self
.oem_strings
.iter()
.map(|s| OEMStringEntryXML { content: s.clone() })
.collect(),
}),
}),
on_poweroff: "destroy".to_string(),
on_reboot: "restart".to_string(),
on_crash: "destroy".to_string(),
@ -476,6 +492,12 @@ impl VMInfo {
.collect::<Result<Vec<_>, _>>()?,
tpm_module: domain.devices.tpm.is_some(),
oem_strings: domain
.sysinfo
.and_then(|s| s.oem_strings)
.map(|s| s.entries.iter().map(|o| o.content.to_string()).collect())
.unwrap_or_default(),
})
}
}