virtio-balloon: Add memory_actual_size to vm.info to show memory actual size

The virtio-balloon change the memory size is asynchronous.
VirtioBalloonConfig.actual of balloon device show current balloon size.

This commit add memory_actual_size to vm.info to show memory actual size.

Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
Hui Zhu
2020-08-25 14:44:21 +08:00
committed by Sebastien Boeuf
parent 9dffc5da5c
commit c75f8b2f89
8 changed files with 93 additions and 8 deletions

View File

@@ -1236,6 +1236,14 @@ impl MemoryManager {
Ok(balloon_size)
}
pub fn get_balloon_actual(&self) -> u64 {
if let Some(balloon) = &self.balloon {
return balloon.lock().unwrap().get_actual();
}
0
}
/// In case this function resulted in adding a new memory region to the
/// guest memory, the new region is returned to the caller. The virtio-mem
/// use case never adds a new region as the whole hotpluggable memory has