mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 23:41:15 +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 crate::{create_app, prepare_default_values};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use vmm::config::{
|
use vmm::config::{
|
||||||
CmdlineConfig, ConsoleConfig, ConsoleOutputMode, CpuFeatures, CpusConfig, MemoryConfig,
|
ConsoleConfig, ConsoleOutputMode, CpuFeatures, CpusConfig, MemoryConfig, PayloadConfig,
|
||||||
PayloadConfig, RngConfig, VmConfig, VmParams,
|
RngConfig, VmConfig, VmParams,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn get_vm_config_from_vec(args: &[&str]) -> VmConfig {
|
fn get_vm_config_from_vec(args: &[&str]) -> VmConfig {
|
||||||
@ -677,11 +677,6 @@ mod unit_tests {
|
|||||||
prefault: false,
|
prefault: false,
|
||||||
zones: None,
|
zones: None,
|
||||||
},
|
},
|
||||||
kernel: None,
|
|
||||||
cmdline: CmdlineConfig {
|
|
||||||
args: String::default(),
|
|
||||||
},
|
|
||||||
initramfs: None,
|
|
||||||
payload: Some(PayloadConfig {
|
payload: Some(PayloadConfig {
|
||||||
kernel: Some(PathBuf::from("/path/to/kernel")),
|
kernel: Some(PathBuf::from("/path/to/kernel")),
|
||||||
..Default::default()
|
..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 {
|
impl DiskConfig {
|
||||||
pub const SYNTAX: &'static str = "Disk parameters \
|
pub const SYNTAX: &'static str = "Disk parameters \
|
||||||
\"path=<disk_image_path>,readonly=on|off,direct=on|off,iommu=on|off,\
|
\"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>> {
|
pub fn validate(&mut self) -> ValidationResult<BTreeSet<String>> {
|
||||||
let mut id_list = BTreeSet::new();
|
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
|
self.payload
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(ValidationError::KernelMissing)?;
|
.ok_or(ValidationError::KernelMissing)?;
|
||||||
@ -2153,9 +2129,6 @@ impl VmConfig {
|
|||||||
let mut config = VmConfig {
|
let mut config = VmConfig {
|
||||||
cpus: CpusConfig::parse(vm_params.cpus)?,
|
cpus: CpusConfig::parse(vm_params.cpus)?,
|
||||||
memory: MemoryConfig::parse(vm_params.memory, vm_params.memory_zones)?,
|
memory: MemoryConfig::parse(vm_params.memory, vm_params.memory_zones)?,
|
||||||
kernel: None,
|
|
||||||
initramfs: None,
|
|
||||||
cmdline: CmdlineConfig::default(),
|
|
||||||
payload,
|
payload,
|
||||||
disks,
|
disks,
|
||||||
net,
|
net,
|
||||||
@ -2748,11 +2721,6 @@ mod tests {
|
|||||||
prefault: false,
|
prefault: false,
|
||||||
zones: None,
|
zones: None,
|
||||||
},
|
},
|
||||||
kernel: None,
|
|
||||||
cmdline: CmdlineConfig {
|
|
||||||
args: String::default(),
|
|
||||||
},
|
|
||||||
initramfs: None,
|
|
||||||
payload: Some(PayloadConfig {
|
payload: Some(PayloadConfig {
|
||||||
kernel: Some(PathBuf::from("/path/to/kernel")),
|
kernel: Some(PathBuf::from("/path/to/kernel")),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -1978,8 +1978,8 @@ const DEVICE_MANAGER_SNAPSHOT_ID: &str = "device-manager";
|
|||||||
mod unit_tests {
|
mod unit_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use config::{
|
use config::{
|
||||||
CmdlineConfig, ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig,
|
ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig, PayloadConfig,
|
||||||
PayloadConfig, RngConfig, VmConfig,
|
RngConfig, VmConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn create_dummy_vmm() -> Vmm {
|
fn create_dummy_vmm() -> Vmm {
|
||||||
@ -2020,11 +2020,6 @@ mod unit_tests {
|
|||||||
prefault: false,
|
prefault: false,
|
||||||
zones: None,
|
zones: None,
|
||||||
},
|
},
|
||||||
kernel: None,
|
|
||||||
cmdline: CmdlineConfig {
|
|
||||||
args: String::default(),
|
|
||||||
},
|
|
||||||
initramfs: None,
|
|
||||||
payload: Some(PayloadConfig {
|
payload: Some(PayloadConfig {
|
||||||
kernel: Some(PathBuf::from("/path/to/kernel")),
|
kernel: Some(PathBuf::from("/path/to/kernel")),
|
||||||
..Default::default()
|
..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)]
|
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
pub struct DiskConfig {
|
pub struct DiskConfig {
|
||||||
pub path: Option<PathBuf>,
|
pub path: Option<PathBuf>,
|
||||||
@ -553,12 +538,6 @@ pub struct VmConfig {
|
|||||||
pub cpus: CpusConfig,
|
pub cpus: CpusConfig,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub memory: MemoryConfig,
|
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 payload: Option<PayloadConfig>,
|
||||||
pub disks: Option<Vec<DiskConfig>>,
|
pub disks: Option<Vec<DiskConfig>>,
|
||||||
pub net: Option<Vec<NetConfig>>,
|
pub net: Option<Vec<NetConfig>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user