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:
Sebastien Boeuf
2020-09-14 17:48:13 +02:00
parent 66fc557015
commit 8b5202aa5a
2 changed files with 13 additions and 34 deletions

View File

@@ -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"))]