virtio-balloon: Store the balloon size to support reboot

This commit store balloon size to MemoryConfig.
After reboot, virtio-balloon can use this size to inflate back to
the size before reboot.

Signed-off-by: Hui Zhu <teawater@antfin.com>
This commit is contained in:
Hui Zhu
2020-06-23 17:52:30 +08:00
committed by Rob Bradford
parent 50da100afd
commit 800220acbb
6 changed files with 24 additions and 12 deletions

View File

@@ -738,7 +738,10 @@ impl Vm {
}
if let Some(desired_ram_w_balloon) = desired_ram_w_balloon {
self.memory_manager
// update the configuration value for the balloon size to ensure
// a reboot would use the right value.
self.config.lock().unwrap().memory.balloon_size = self
.memory_manager
.lock()
.unwrap()
.balloon_resize(desired_ram_w_balloon)