Make the postcopy tests (including TLS) pass a config argument to
migration QMP commands.

Temporarily, set the use-config key to enable the new method.

Signed-off-by: Fabiano Rosas <[email protected]>
---
 tests/qtest/migration/framework.c      | 10 ++++++++--
 tests/qtest/migration/postcopy-tests.c | 10 +++++-----
 tests/qtest/migration/tls-tests.c      | 14 +++++++++-----
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/tests/qtest/migration/framework.c 
b/tests/qtest/migration/framework.c
index ecfeee570e..8f179ea2fa 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -582,8 +582,8 @@ static int migrate_postcopy_prepare(QTestState **from_ptr,
     QObject *channels;
 
     /* set postcopy capabilities */
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME] = true;
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] = true;
+    qdict_put_bool(args->start.config, "postcopy-blocktime", true);
+    qdict_put_bool(args->start.config, "postcopy-ram", true);
 
     if (migrate_start(&from, &to, "defer", &args->start)) {
         return -1;
@@ -652,6 +652,9 @@ void test_postcopy_common(MigrateCommon *args)
 {
     QTestState *from, *to;
 
+    /* temporary */
+    qdict_put_bool(args->start.config, "use-config", true);
+
     if (migrate_postcopy_prepare(&from, &to, args)) {
         return;
     }
@@ -785,6 +788,9 @@ void test_postcopy_recovery_common(MigrateCommon *args)
     QTestState *from, *to;
     g_autofree char *uri = NULL;
 
+    /* temporary */
+    qdict_put_bool(args->start.config, "use-config", true);
+
     /*
      * Always enable OOB QMP capability for recovery tests, migrate-recover is
      * executed out-of-band
diff --git a/tests/qtest/migration/postcopy-tests.c 
b/tests/qtest/migration/postcopy-tests.c
index 7ae4d765d7..5136a26abd 100644
--- a/tests/qtest/migration/postcopy-tests.c
+++ b/tests/qtest/migration/postcopy-tests.c
@@ -34,7 +34,7 @@ static void test_postcopy_suspend(char *name, MigrateCommon 
*args)
 
 static void test_postcopy_preempt(char *name, MigrateCommon *args)
 {
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_common(args);
 }
@@ -62,7 +62,7 @@ static void test_postcopy_recovery_fail_reconnect(char *name,
 
 static void test_postcopy_preempt_recovery(char *name, MigrateCommon *args)
 {
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_recovery_common(args);
 }
@@ -80,15 +80,15 @@ static void 
migration_test_add_postcopy_smoke(MigrationTestEnv *env)
 
 static void test_multifd_postcopy(char *name, MigrateCommon *args)
 {
-    args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
+    qdict_put_bool(args->start.config, "multifd", true);
 
     test_postcopy_common(args);
 }
 
 static void test_multifd_postcopy_preempt(char *name, MigrateCommon *args)
 {
-    args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "multifd", true);
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_common(args);
 }
diff --git a/tests/qtest/migration/tls-tests.c 
b/tests/qtest/migration/tls-tests.c
index 5f561bc602..abd6bf9281 100644
--- a/tests/qtest/migration/tls-tests.c
+++ b/tests/qtest/migration/tls-tests.c
@@ -131,6 +131,8 @@ static void test_postcopy_tls_psk_common(MigrateCommon 
*args,
 {
     TestMigrateTLSPSKData *data = g_new0(TestMigrateTLSPSKData, 1);
 
+    qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0");
+
     migrate_tls_psk_init(args, test_args, data);
     test_postcopy_common(args);
     migrate_tls_psk_cleanup(data);
@@ -141,6 +143,8 @@ static void 
test_postcopy_recovery_tls_psk_common(MigrateCommon *args,
 {
     TestMigrateTLSPSKData *data = g_new0(TestMigrateTLSPSKData, 1);
 
+    qdict_put_str(args->start.config, "tls-creds", "tlscredspsk0");
+
     migrate_tls_psk_init(args, test_args, data);
     test_postcopy_recovery_common(args);
     migrate_tls_psk_cleanup(data);
@@ -382,7 +386,7 @@ static void test_postcopy_preempt_tls_psk(char *name, 
MigrateCommon *args)
     args->start_hook_full = migrate_hook_start_tls_psk_common;
     args->start_hook_data = &tls_psk_match;
 
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_tls_psk_common(args, &tls_psk_match);
 }
@@ -401,7 +405,7 @@ static void test_multifd_postcopy_recovery_tls_psk(char 
*name,
     args->start_hook_full = migrate_hook_start_tls_psk_common;
     args->start_hook_data = &tls_psk_match;
 
-    args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
+    qdict_put_bool(args->start.config, "multifd", true);
 
     test_postcopy_recovery_tls_psk_common(args, &tls_psk_match);
 }
@@ -412,7 +416,7 @@ static void test_postcopy_preempt_all(char *name, 
MigrateCommon *args)
     args->start_hook_full = migrate_hook_start_tls_psk_common;
     args->start_hook_data = &tls_psk_match;
 
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_recovery_tls_psk_common(args, &tls_psk_match);
 }
@@ -423,8 +427,8 @@ static void 
test_multifd_postcopy_preempt_recovery_tls_psk(char *name,
     args->start_hook_full = migrate_hook_start_tls_psk_common;
     args->start_hook_data = &tls_psk_match;
 
-    args->start.caps[MIGRATION_CAPABILITY_MULTIFD] = true;
-    args->start.caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT] = true;
+    qdict_put_bool(args->start.config, "multifd", true);
+    qdict_put_bool(args->start.config, "postcopy-preempt", true);
 
     test_postcopy_recovery_tls_psk_common(args, &tls_psk_match);
 }
-- 
2.51.0


Reply via email to