From 83cc554f9002d5d80362148aa8d37265b46d2392 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 6 Oct 2022 13:45:37 +0100 Subject: [PATCH] vmm: Remove deprecated VmConfig::{kernel, initramfs, cmdline} members These have been replaced by members of PayloadConfig and should be removed in v28.0 (mentioned in v26.0 release notes.) Fixes: #4737 Signed-off-by: Rob Bradford --- src/main.rs | 9 ++------- vmm/src/config.rs | 32 -------------------------------- vmm/src/lib.rs | 9 ++------- vmm/src/vm_config.rs | 21 --------------------- 4 files changed, 4 insertions(+), 67 deletions(-) diff --git a/src/main.rs b/src/main.rs index ab5946a74..b892f38e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -615,8 +615,8 @@ mod unit_tests { use crate::{create_app, prepare_default_values}; use std::path::PathBuf; use vmm::config::{ - CmdlineConfig, ConsoleConfig, ConsoleOutputMode, CpuFeatures, CpusConfig, MemoryConfig, - PayloadConfig, RngConfig, VmConfig, VmParams, + ConsoleConfig, ConsoleOutputMode, CpuFeatures, CpusConfig, MemoryConfig, PayloadConfig, + RngConfig, VmConfig, VmParams, }; fn get_vm_config_from_vec(args: &[&str]) -> VmConfig { @@ -677,11 +677,6 @@ mod unit_tests { prefault: false, zones: None, }, - kernel: None, - cmdline: CmdlineConfig { - args: String::default(), - }, - initramfs: None, payload: Some(PayloadConfig { kernel: Some(PathBuf::from("/path/to/kernel")), ..Default::default() diff --git a/vmm/src/config.rs b/vmm/src/config.rs index ce4c0e0b3..2039eb335 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -804,16 +804,6 @@ impl MemoryConfig { } } -impl CmdlineConfig { - pub fn parse(cmdline: Option<&str>) -> Result { - let args = cmdline - .map(std::string::ToString::to_string) - .unwrap_or_else(String::new); - - Ok(CmdlineConfig { args }) - } -} - impl DiskConfig { pub const SYNTAX: &'static str = "Disk parameters \ \"path=,readonly=on|off,direct=on|off,iommu=on|off,\ @@ -1788,20 +1778,6 @@ impl VmConfig { pub fn validate(&mut self) -> ValidationResult> { let mut id_list = BTreeSet::new(); - if self.kernel.is_some() { - warn!("The \"VmConfig\" members \"kernel\", \"cmdline\" and \"initramfs\" are deprecated. Use \"payload\" member instead."); - self.payload = Some(PayloadConfig { - kernel: self.kernel.take().map(|k| k.path), - cmdline: if self.cmdline.args.is_empty() { - None - } else { - Some(self.cmdline.args.drain(..).collect()) - }, - initramfs: self.initramfs.take().map(|i| i.path), - ..Default::default() - }) - } - self.payload .as_ref() .ok_or(ValidationError::KernelMissing)?; @@ -2153,9 +2129,6 @@ impl VmConfig { let mut config = VmConfig { cpus: CpusConfig::parse(vm_params.cpus)?, memory: MemoryConfig::parse(vm_params.memory, vm_params.memory_zones)?, - kernel: None, - initramfs: None, - cmdline: CmdlineConfig::default(), payload, disks, net, @@ -2748,11 +2721,6 @@ mod tests { prefault: false, zones: None, }, - kernel: None, - cmdline: CmdlineConfig { - args: String::default(), - }, - initramfs: None, payload: Some(PayloadConfig { kernel: Some(PathBuf::from("/path/to/kernel")), ..Default::default() diff --git a/vmm/src/lib.rs b/vmm/src/lib.rs index 94c8cddab..76c62fc48 100644 --- a/vmm/src/lib.rs +++ b/vmm/src/lib.rs @@ -1978,8 +1978,8 @@ const DEVICE_MANAGER_SNAPSHOT_ID: &str = "device-manager"; mod unit_tests { use super::*; use config::{ - CmdlineConfig, ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig, - PayloadConfig, RngConfig, VmConfig, + ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig, PayloadConfig, + RngConfig, VmConfig, }; fn create_dummy_vmm() -> Vmm { @@ -2020,11 +2020,6 @@ mod unit_tests { prefault: false, zones: None, }, - kernel: None, - cmdline: CmdlineConfig { - args: String::default(), - }, - initramfs: None, payload: Some(PayloadConfig { kernel: Some(PathBuf::from("/path/to/kernel")), ..Default::default() diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index a1bc45e90..a07a51922 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -193,21 +193,6 @@ impl Default for VhostMode { } } -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct KernelConfig { - pub path: PathBuf, -} - -#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] -pub struct InitramfsConfig { - pub path: PathBuf, -} - -#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)] -pub struct CmdlineConfig { - pub args: String, -} - #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] pub struct DiskConfig { pub path: Option, @@ -553,12 +538,6 @@ pub struct VmConfig { pub cpus: CpusConfig, #[serde(default)] pub memory: MemoryConfig, - pub kernel: Option, - #[serde(default)] - pub initramfs: Option, - #[serde(default)] - pub cmdline: CmdlineConfig, - #[serde(default)] pub payload: Option, pub disks: Option>, pub net: Option>,