mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
@@ -340,6 +340,8 @@ pub struct MemoryConfig {
|
||||
pub hugepages: bool,
|
||||
#[serde(default)]
|
||||
pub balloon: bool,
|
||||
#[serde(default)]
|
||||
pub balloon_size: u64,
|
||||
}
|
||||
|
||||
impl MemoryConfig {
|
||||
@@ -400,6 +402,7 @@ impl MemoryConfig {
|
||||
shared,
|
||||
hugepages,
|
||||
balloon,
|
||||
balloon_size: 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -415,6 +418,7 @@ impl Default for MemoryConfig {
|
||||
shared: false,
|
||||
hugepages: false,
|
||||
balloon: false,
|
||||
balloon_size: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1873,6 +1877,7 @@ mod tests {
|
||||
shared: false,
|
||||
hugepages: false,
|
||||
balloon: false,
|
||||
balloon_size: 0,
|
||||
},
|
||||
kernel: Some(KernelConfig {
|
||||
path: PathBuf::from("/path/to/kernel"),
|
||||
|
||||
Reference in New Issue
Block a user