mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm, main: Add optional "hotplug_size" to --mem
This specifies how much address space should be reserved for hotplugging of RAM. This space is reserved by adding move the start of the device area by the desired amount. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
f1b6657833
commit
f5137e84bb
@@ -248,6 +248,8 @@ pub struct MemoryConfig {
|
||||
pub file: Option<PathBuf>,
|
||||
#[serde(default)]
|
||||
pub mergeable: bool,
|
||||
#[serde(default)]
|
||||
pub hotplug_size: Option<u64>,
|
||||
}
|
||||
|
||||
impl MemoryConfig {
|
||||
@@ -259,6 +261,7 @@ impl MemoryConfig {
|
||||
let mut file_str: &str = "";
|
||||
let mut mergeable_str: &str = "";
|
||||
let mut backed = false;
|
||||
let mut hotplug_str: &str = "";
|
||||
|
||||
for param in params_list.iter() {
|
||||
if param.starts_with("size=") {
|
||||
@@ -268,6 +271,8 @@ impl MemoryConfig {
|
||||
file_str = ¶m[5..];
|
||||
} else if param.starts_with("mergeable=") {
|
||||
mergeable_str = ¶m[10..];
|
||||
} else if param.starts_with("hotplug_size=") {
|
||||
hotplug_str = ¶m[13..]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,6 +290,11 @@ impl MemoryConfig {
|
||||
size: parse_size(size_str)?,
|
||||
file,
|
||||
mergeable: parse_on_off(mergeable_str)?,
|
||||
hotplug_size: if hotplug_str == "" {
|
||||
None
|
||||
} else {
|
||||
Some(parse_size(hotplug_str)?)
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -295,6 +305,7 @@ impl Default for MemoryConfig {
|
||||
size: DEFAULT_MEMORY_MB << 20,
|
||||
file: None,
|
||||
mergeable: false,
|
||||
hotplug_size: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user