vmm: memory_actual_size reflects hotplug state

It is desirable to be able to track the progress of memory hotplug.
Update the memory_actual_size field to query the current plugged size
from virtio-mem to enable this.

Signed-off-by: Jared White <git@jaredwhite.dev>
This commit is contained in:
Jared White
2026-04-05 21:36:07 -07:00
committed by Bo Chen
parent aef0a43b52
commit 77ce3f6cbf
5 changed files with 45 additions and 15 deletions
+3 -1
View File
@@ -1915,9 +1915,11 @@ impl RequestHandler for Vmm {
};
let config = vm_config.lock().unwrap().clone();
let mut memory_actual_size = config.memory.total_size();
let mut memory_actual_size =
config.memory.total_size() - config.memory.hotplugged_size();
if let Some(vm) = &self.vm {
memory_actual_size = memory_actual_size.saturating_sub(vm.balloon_size());
memory_actual_size += vm.virtio_mem_plugged_size();
}
let device_tree = self