mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add 'hotplug_size' to memory zones
In anticipation for resizing support of an individual memory zone, this commit introduces a new option 'hotplug_size' to '--memory-zone' parameter. This defines the amount of memory that can be added through each specific memory zone. Because memory zone resize is tied to virtio-mem, make sure the user selects 'virtio-mem' hotplug method, otherwise return an error. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -215,6 +215,9 @@ pub enum Error {
|
||||
|
||||
/// Invalid size for resizing. Can be anything except 0.
|
||||
InvalidHotplugSize,
|
||||
|
||||
/// Invalid hotplug method associated with memory zones resizing capability.
|
||||
InvalidHotplugMethodWithMemoryZones,
|
||||
}
|
||||
|
||||
const ENABLE_FLAG: usize = 0;
|
||||
@@ -442,6 +445,7 @@ impl MemoryManager {
|
||||
shared: config.shared,
|
||||
hugepages: config.hugepages,
|
||||
host_numa_node: None,
|
||||
hotplug_size: config.hotplug_size,
|
||||
}];
|
||||
|
||||
(config.size, zones)
|
||||
@@ -472,6 +476,11 @@ impl MemoryManager {
|
||||
);
|
||||
return Err(Error::InvalidSharedMemoryZoneWithHostNuma);
|
||||
}
|
||||
|
||||
if zone.hotplug_size.is_some() && config.hotplug_method == HotplugMethod::Acpi {
|
||||
error!("Invalid to set ACPI hotplug method for memory zones");
|
||||
return Err(Error::InvalidHotplugMethodWithMemoryZones);
|
||||
}
|
||||
}
|
||||
|
||||
(total_ram_size, zones)
|
||||
|
||||
Reference in New Issue
Block a user