mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: memory_manager: Make sure the hotplugged_size is up to date
The amount of memory plugged in the virtio-mem region should always be kept up to date in the hotplugged_size field from VirtioMemZone. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
c4dc7a583d
commit
7bbcc0f849
@ -1314,11 +1314,14 @@ impl MemoryManager {
|
||||
|
||||
pub fn virtio_mem_resize(&mut self, id: &str, size: u64) -> Result<(), Error> {
|
||||
if let Some(memory_zone) = self.memory_zones.get_mut(id) {
|
||||
if let Some(virtio_mem_zone) = memory_zone.virtio_mem_zone() {
|
||||
if let Some(virtio_mem_zone) = &mut memory_zone.virtio_mem_zone {
|
||||
virtio_mem_zone
|
||||
.resize_handler()
|
||||
.work(size)
|
||||
.map_err(Error::VirtioMemResizeFail)?;
|
||||
|
||||
// Keep the hotplugged_size up to date.
|
||||
virtio_mem_zone.hotplugged_size = size;
|
||||
} else {
|
||||
error!("Failed resizing virtio-mem region: No virtio-mem handler");
|
||||
return Err(Error::MissingVirtioMemHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user