virtio-devices: mem: Add snapshot/restore support

Adding the snapshot/restore support along with migration as well,
allowing a VM with virtio-mem devices attached to be properly
migrated.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2021-09-22 17:26:30 +02:00
committed by Bo Chen
parent 7bbcc0f849
commit d7115ec656
3 changed files with 73 additions and 34 deletions

View File

@@ -698,11 +698,12 @@ impl MemoryManager {
virtio_mem_regions.push(region.clone());
let hotplugged_size = zone.hotplugged_size.unwrap_or(0);
memory_zone.virtio_mem_zone = Some(VirtioMemZone {
region,
resize_handler: virtio_devices::Resize::new()
resize_handler: virtio_devices::Resize::new(hotplugged_size)
.map_err(Error::EventFdFail)?,
hotplugged_size: zone.hotplugged_size.unwrap_or(0),
hotplugged_size,
hugepages: zone.hugepages,
});