mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
@@ -2420,6 +2420,19 @@ impl MemoryManager {
|
||||
unsafe { (*stat.as_ptr()).st_nlink as usize > 0 }
|
||||
}
|
||||
|
||||
pub fn virtio_mem_plugged_size(&self) -> u64 {
|
||||
self.memory_zones
|
||||
.values()
|
||||
.filter_map(|zone| {
|
||||
zone.virtio_mem_zone
|
||||
.as_ref()?
|
||||
.virtio_device
|
||||
.as_ref()
|
||||
.map(|dev| dev.lock().unwrap().plugged_size())
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
|
||||
pub fn memory_zones(&self) -> &MemoryZones {
|
||||
&self.memory_zones
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user