From 8eba52c97829a05180404b5b12d65bdf306b7b8b Mon Sep 17 00:00:00 2001 From: Anushree Mathur Date: Wed, 25 Nov 2026 12:12:41 +0530 Subject: [PATCH] pci_passthrough: add negative_migration_with_passthrough variant The tp-libvirt libvirt_pci_passthrough test gained a negative_migration_with_passthrough variant. A guest with a VFIO passthrough device cannot be live migrated, because the device state cannot be transferred. The test starts a guest with the passthrough device, attempts "virsh migrate" to another host, and passes only if the migration fails with the expected error and the guest keeps running on the source host. Add a negative_migration_with_passthrough entry to pci_passthrough.cfg so the new test is picked up when this suite is run. It selects libvirt_pci_passthrough.negative_migration_with_passthrough and declares the parameters the test reads: migrate_dest_host IP address of a reachable destination host, used as qemu+ssh:///system. System specific, so it is an "ENTER.YOUR.DEST.HOST.IP" placeholder with an example. The test cancels itself while the placeholder is not replaced. negative_migrate_options options passed to virsh migrate ("--live --p2p --tunnelled") negative_migrate_expected_err error expected when the migration is refused. libvirt reports "VFIO migration init failed: migration is not supported in kernel", so the match string is "migration is not supported in kernel". The variant is placed before guest_remove, since guest_remove deletes the guest that the test needs. Depends on the tp-libvirt change for the negative_migration_with_passthrough test in libvirt_pci_passthrough. Signed-off-by: Anushree Mathur --- config/tests/guest/libvirt/pci_passthrough.cfg | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/tests/guest/libvirt/pci_passthrough.cfg b/config/tests/guest/libvirt/pci_passthrough.cfg index 5f59324f..cd79c910 100644 --- a/config/tests/guest/libvirt/pci_passthrough.cfg +++ b/config/tests/guest/libvirt/pci_passthrough.cfg @@ -90,5 +90,21 @@ variants: - pci_passthrough_eeh: only libvirt_pci_passthrough_eeh + - negative_migration_with_passthrough: + only libvirt_pci_passthrough.negative_migration_with_passthrough + # Negative test: live migration of a guest that has a VFIO + # passthrough device must fail, because the device state can not be + # migrated. The test passes only if the migration fails with the + # expected error. The guest stays on the source host. + # IP address of any reachable destination host (the migration is + # blocked, so nothing is actually moved). Must be reachable with + # passwordless ssh as qemu+ssh:///system. + # Eg: 10.0.0.2 + migrate_dest_host = "ENTER.YOUR.DEST.HOST.IP" + # Options passed to virsh migrate + negative_migrate_options = "--live --p2p --tunnelled" + # Error expected from libvirt when the migration is refused + negative_migrate_expected_err = "migration is not supported in kernel" + - guest_remove: only remove_guest.without_disk