Update the migration test to check we correctly wait the end of the card unplug before doing the migration.
Signed-off-by: Laurent Vivier <lviv...@redhat.com> --- tests/qtest/virtio-net-failover.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-failover.c index 11fa0b21f8bf..9a81133154d6 100644 --- a/tests/qtest/virtio-net-failover.c +++ b/tests/qtest/virtio-net-failover.c @@ -541,6 +541,29 @@ static void test_outmigrate(gconstpointer opaque) qobject_unref(resp); + /* wait the end of the migration setup phase */ + while (true) { + const gchar *status; + + ret = migrate_status(qts); + + status = qdict_get_str(ret, "status"); + if (strcmp(status, "wait-unplug") == 0) { + break; + } + + /* The migration must not start if the card is not ejected */ + g_assert_cmpstr(status, !=, "active"); + g_assert_cmpstr(status, !=, "completed"); + g_assert_cmpstr(status, !=, "failed"); + g_assert_cmpstr(status, !=, "cancelling"); + g_assert_cmpstr(status, !=, "cancelled"); + + qobject_unref(ret); + } + qobject_unref(ret); + + /* OS unplugs the cards, QEMU can move from wait-unplug state */ qtest_outl(qts, ACPI_PCIHP_ADDR_ICH9 + PCI_EJ_BASE, 1); qtest_qmp_eventwait(qts, "STOP"); -- 2.33.1