mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
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 <robert.bradford@intel.com>
This commit is contained in:
parent
7d8d27c1b4
commit
83cc554f90
@ -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()
|
||||
|
@ -804,16 +804,6 @@ impl MemoryConfig {
|
||||
}
|
||||
}
|
||||
|
||||
impl CmdlineConfig {
|
||||
pub fn parse(cmdline: Option<&str>) -> Result<Self> {
|
||||
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=<disk_image_path>,readonly=on|off,direct=on|off,iommu=on|off,\
|
||||
@ -1788,20 +1778,6 @@ impl VmConfig {
|
||||
pub fn validate(&mut self) -> ValidationResult<BTreeSet<String>> {
|
||||
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()
|
||||
|
@ -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()
|
||||
|
@ -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<PathBuf>,
|
||||
@ -553,12 +538,6 @@ pub struct VmConfig {
|
||||
pub cpus: CpusConfig,
|
||||
#[serde(default)]
|
||||
pub memory: MemoryConfig,
|
||||
pub kernel: Option<KernelConfig>,
|
||||
#[serde(default)]
|
||||
pub initramfs: Option<InitramfsConfig>,
|
||||
#[serde(default)]
|
||||
pub cmdline: CmdlineConfig,
|
||||
#[serde(default)]
|
||||
pub payload: Option<PayloadConfig>,
|
||||
pub disks: Option<Vec<DiskConfig>>,
|
||||
pub net: Option<Vec<NetConfig>>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user