mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
The VFIO save and load paths drive the kernel migration state machine through a strict transition sequence and must recover correctly when a transition or the data transfer fails. Validating that on real hardware needs a migratable device, which CI does not have, so the behavior would otherwise go unverified until it breaks in the field. Introduce a mock Vfio wrapper that records state transitions and keeps the migration blob in memory, then test VfioCommon save and load against it. This pins the transition ordering, the data round trip, and the failure recovery in CI on any host, independent of hardware. The trait defaults and the VfioMigrationState conversions are covered too, so a non migratable device and an unknown state value stay well defined. A restore that carries migration state onto a device without migration support is checked to fail instead of dropping the state. A shadow sync test guards the related save path change, confirming a non BAR config write reaches the PciConfiguration shadow so a snapshot captures the live value instead of the post init zero. Signed-off-by: Saravanan D <saravanand@crusoe.ai>