mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Always add virtio-mem region upon VM creation
Now that e820 tables are created from the 'boot_guest_memory', we can simplify the memory manager code by adding the virtio-mem regions when they are created. There's no need to wait for the first hotplug to insert these regions. This also anticipates the need for starting a VM with some memory already plugged into the virtio-mem region. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -925,22 +925,11 @@ impl Vm {
|
||||
}
|
||||
|
||||
pub fn resize_zone(&mut self, id: String, desired_memory: u64) -> Result<()> {
|
||||
let new_region = self
|
||||
.memory_manager
|
||||
self.memory_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.resize_zone(&id, desired_memory, &self.config.lock().unwrap().memory)
|
||||
.map_err(Error::MemoryManager)?;
|
||||
|
||||
if let Some(new_region) = &new_region {
|
||||
self.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.update_memory(&new_region)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
.map_err(Error::MemoryManager)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "pci_support"))]
|
||||
|
||||
Reference in New Issue
Block a user