Skip to contentSkip to conversation

tests/migration-test: Wait for cancellation sooner in multifd cancel

PATCH Applied Juraj Marcin 2 participants 2 messages Sep 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/migration-test: Wait for cancellation sooner in multifd cancel

The source QEMU might not finish the cancellation of the migration before we start setting up the next attempt. During the setup, the test_migrate_start() function and others might need to interact with the source in a way that is not possible unless the migration is fully canceled. For example, setting capabilities when the migration is still running leads to an error.

By moving the wait before the setup, we ensure this does not happen.

---
 tests/qtest/migration-test.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +10 -2
index 814ec109a6..95e45b5029 100644
@@ -3267,6 +3267,16 @@ static void test_multifd_tcp_cancel(void)
     qtest_wait_qemu(to);
     qtest_quit(to);
 
+    /*
+     * Ensure the source QEMU finishes its cancellation process before we
+     * proceed with the setup of the next migration. The test_migrate_start()
+     * function and others might want to interact with the source in a way that
+     * is not possible while the migration is not canceled properly. For
+     * example, setting migration capabilities when the migration is still
+     * running leads to an error.
+     */
+    wait_for_migration_status(from, "cancelled", NULL);
+
     args = (MigrateStart){
         .only_target = true,
     };
@@ -3282,8 +3292,6 @@ static void test_multifd_tcp_cancel(void)
     /* Start incoming migration from the 1st socket */
     migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}");
 
-    wait_for_migration_status(from, "cancelled", NULL);
-
     migrate_ensure_non_converge(from);
 
     migrate_qmp(from, to2, NULL, NULL, "{}");
Signature · 1 line
2.46.1
Applied
#1 lore raw
Quoted 11 lines · Juraj Marcin

The source QEMU might not finish the cancellation of the migration before we start setting up the next attempt. During the setup, the test_migrate_start() function and others might need to interact with the source in a way that is not possible unless the migration is fully canceled. For example, setting capabilities when the migration is still running leads to an error.

By moving the wait before the setup, we ensure this does not happen.

+Fabiano, +PeterM.

Some more context: this issue Juraj can only reproduce in one of our downstream 9.2 branch with some probably over crowded build systems. But logically it looks still possible to also happen upstream..

queued, thanks!

Quoted 37 lines
---
 tests/qtest/migration-test.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
tests/qtest/migration-test.c +10 -2
index 814ec109a6..95e45b5029 100644
@@ -3267,6 +3267,16 @@ static void test_multifd_tcp_cancel(void)
     qtest_wait_qemu(to);
     qtest_quit(to);
 
+    /*
+     * Ensure the source QEMU finishes its cancellation process before we
+     * proceed with the setup of the next migration. The test_migrate_start()
+     * function and others might want to interact with the source in a way that
+     * is not possible while the migration is not canceled properly. For
+     * example, setting migration capabilities when the migration is still
+     * running leads to an error.
+     */
+    wait_for_migration_status(from, "cancelled", NULL);
+
     args = (MigrateStart){
         .only_target = true,
     };
@@ -3282,8 +3292,6 @@ static void test_multifd_tcp_cancel(void)
     /* Start incoming migration from the 1st socket */
     migrate_incoming_qmp(to2, "tcp:127.0.0.1:0", "{}");
 
-    wait_for_migration_status(from, "cancelled", NULL);
-
     migrate_ensure_non_converge(from);
 
     migrate_qmp(from, to2, NULL, NULL, "{}");
Signature · 1 line
2.46.1
Signature · 1 line
Peter Xu