mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: vm_config: apply serde defaults to FwCfgConfig
FwCfgConfig already has a Default impl (e820/kernel/cmdline/initramfs/ acpi_tables = true, items = None), but deserialization did not use it: without serde default every field was mandatory, so any caller building a payload config over the API had to spell out the whole object even to flip a single flag. Add a container-level #[serde(default)] so missing fields fall back to FwCfgConfig::default(). The container form is required here because the defaults are all true; a per-field #[serde(default)] would resolve bool to false and contradict the Default impl. This lets callers send only the fields that differ from the defaults. Assisted-by: Claude:Opus-4.8 Signed-off-by: Ruben Hakobyan <hruben@meta.com>
This commit is contained in:
committed by
Rob Bradford
parent
1071a3d301
commit
b1d33ec9aa
@@ -939,6 +939,7 @@ pub struct PayloadConfig {
|
||||
#[cfg(feature = "fw_cfg")]
|
||||
#[serde_with::skip_serializing_none]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||
#[serde(default)]
|
||||
pub struct FwCfgConfig {
|
||||
pub e820: bool,
|
||||
pub kernel: bool,
|
||||
|
||||
Reference in New Issue
Block a user