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:
@@ -410,10 +410,11 @@ pub struct Balloon {
|
||||
|
||||
impl Balloon {
|
||||
// Create a new virtio-balloon.
|
||||
pub fn new(id: String) -> io::Result<Self> {
|
||||
pub fn new(id: String, size: u64) -> io::Result<Self> {
|
||||
let avail_features = 1u64 << VIRTIO_F_VERSION_1;
|
||||
|
||||
let config = VirtioBalloonConfig::default();
|
||||
let mut config = VirtioBalloonConfig::default();
|
||||
config.num_pages = (size >> PAGE_SHIFT) as u32;
|
||||
|
||||
Ok(Balloon {
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user