From b1d33ec9aad5705c7e3e7ddeaca98e867a65997e Mon Sep 17 00:00:00 2001 From: Ruben Hakobyan Date: Mon, 8 Jun 2026 08:30:16 -0700 Subject: [PATCH] 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 --- vmm/src/vm_config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index 0ce723ffc..3f5c1544e 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -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,