mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add support for resizing the memory used by the VM
For now the new memory size is only used after a reboot but support for hotplugging memory will be added in a later commit. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Samuel Ortiz
parent
78dcb1862c
commit
82fce5a4e2
@@ -482,7 +482,7 @@ impl Vm {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, desired_vcpus: Option<u8>) -> Result<()> {
|
||||
pub fn resize(&mut self, desired_vcpus: Option<u8>, desired_memory: Option<u64>) -> Result<()> {
|
||||
if let Some(desired_vcpus) = desired_vcpus {
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
@@ -495,6 +495,9 @@ impl Vm {
|
||||
self.config.lock().unwrap().cpus.boot_vcpus = desired_vcpus;
|
||||
}
|
||||
|
||||
if let Some(desired_memory) = desired_memory {
|
||||
self.config.lock().unwrap().memory.size = desired_memory;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user