mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: provide oem_strings option
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -636,6 +636,8 @@ pub struct PlatformConfig {
|
||||
pub serial_number: Option<String>,
|
||||
#[serde(default)]
|
||||
pub uuid: Option<String>,
|
||||
#[serde(default)]
|
||||
pub oem_strings: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
impl PlatformConfig {
|
||||
@@ -645,6 +647,7 @@ impl PlatformConfig {
|
||||
parser.add("iommu_segments");
|
||||
parser.add("serial_number");
|
||||
parser.add("uuid");
|
||||
parser.add("oem_strings");
|
||||
parser.parse(platform).map_err(Error::ParsePlatform)?;
|
||||
|
||||
let num_pci_segments: u16 = parser
|
||||
@@ -659,11 +662,16 @@ impl PlatformConfig {
|
||||
.convert("serial_number")
|
||||
.map_err(Error::ParsePlatform)?;
|
||||
let uuid = parser.convert("uuid").map_err(Error::ParsePlatform)?;
|
||||
let oem_strings = parser
|
||||
.convert::<StringList>("oem_strings")
|
||||
.map_err(Error::ParsePlatform)?
|
||||
.map(|v| v.0);
|
||||
Ok(PlatformConfig {
|
||||
num_pci_segments,
|
||||
iommu_segments,
|
||||
serial_number,
|
||||
uuid,
|
||||
oem_strings,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -693,6 +701,7 @@ impl Default for PlatformConfig {
|
||||
iommu_segments: None,
|
||||
serial_number: None,
|
||||
uuid: None,
|
||||
oem_strings: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,6 +1127,18 @@ impl Vm {
|
||||
.as_ref()
|
||||
.and_then(|p| p.uuid.clone());
|
||||
|
||||
let oem_strings = self
|
||||
.config
|
||||
.lock()
|
||||
.unwrap()
|
||||
.platform
|
||||
.as_ref()
|
||||
.and_then(|p| p.oem_strings.clone());
|
||||
|
||||
let oem_strings = oem_strings
|
||||
.as_deref()
|
||||
.map(|strings| strings.iter().map(|s| s.as_ref()).collect::<Vec<&str>>());
|
||||
|
||||
arch::configure_system(
|
||||
&mem,
|
||||
arch::layout::CMDLINE_START,
|
||||
@@ -1136,6 +1148,7 @@ impl Vm {
|
||||
sgx_epc_region,
|
||||
serial_number.as_deref(),
|
||||
uuid.as_deref(),
|
||||
oem_strings.as_deref(),
|
||||
)
|
||||
.map_err(Error::ConfigureSystem)?;
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user