migration: Unify capabilities and parameters
PATCH v3 51/51 tests/qtest/migration: Further simplify TLS tests
In reply to Fabiano RosasNow that the TLS hooks were simplified, many test functions are using the same hook, but passing a different data pointer. Since the data pointer is already an argument for the _common function, stop setting the hook & data in the test function and do it instead in the init routine.
--- tests/qtest/migration/tls-tests.c | 60 +++++-------------------------- 1 file changed, 8 insertions(+), 52 deletions(-)
tests/qtest/migration/tls-tests.c +8 -52
@@ -80,6 +80,11 @@ static void migrate_tls_psk_init(MigrateCommon *args, TestMigrateTLSPSK *test_args, TestMigrateTLSPSKData *data) { +qdict_put_str (args->start.config,"tls-creds" ,"tlscredspsk0" ); + + args->start_hook_full = migrate_hook_start_tls_psk_common; + args->start_hook_data = test_args; + data->workdir =g_strdup_printf ("%s/tlscredspsk0" , tmpfs); data->pskfile =g_strdup_printf ("%s/%s" , data->workdir,QCRYPTO_TLS_CREDS_PSKFILE );
@@ -118,8 +123,6 @@ static void test_precopy_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_precopy_common (args);migrate_tls_psk_cleanup (data);
@@ -130,8 +133,6 @@ 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);
@@ -142,8 +143,6 @@ 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);
@@ -283,6 +282,9 @@ static void migrate_tls_x509_init(MigrateCommon *args, TestMigrateTLSX509 *test_args, TestMigrateTLSX509Data *data) { + args->start_hook_full = migrate_hook_start_tls_x509_common; + args->start_hook_data = test_args; + data->workdir =g_strdup_printf ("%s/tlscredsx5090" , tmpfs); data->keyfile =g_strdup_printf ("%s/key.pem" , data->workdir);
@@ -390,17 +392,11 @@ static void test_precopy_tls_x509_common(MigrateCommon *args,static void test_postcopy_tls_psk (char *name,MigrateCommon *args) { - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match; -test_postcopy_tls_psk_common (args, &tls_psk_match); }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; -qdict_put_bool (args->start.config,"postcopy-preempt" , true);test_postcopy_tls_psk_common (args, &tls_psk_match);
@@ -408,18 +404,12 @@ static void test_postcopy_preempt_tls_psk(char *name, MigrateCommon *args)static void test_postcopy_recovery_tls_psk (char *name,MigrateCommon *args) { - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match; -test_postcopy_recovery_tls_psk_common (args, &tls_psk_match); }static void test_multifd_postcopy_recovery_tls_psk (char *name,MigrateCommon *args) { - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match; -qdict_put_bool (args->start.config,"multifd" , true);test_postcopy_recovery_tls_psk_common (args, &tls_psk_match);
@@ -428,9 +418,6 @@ static void test_multifd_postcopy_recovery_tls_psk(char *name,/* This contains preempt+recovery+tls test altogether */ 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; -qdict_put_bool (args->start.config,"postcopy-preempt" , true);test_postcopy_recovery_tls_psk_common (args, &tls_psk_match);
@@ -439,9 +426,6 @@ static void test_postcopy_preempt_all(char *name, MigrateCommon *args)static void test_multifd_postcopy_preempt_recovery_tls_psk (char *name,MigrateCommon *args) { - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match; -qdict_put_bool (args->start.config,"multifd" , true);qdict_put_bool (args->start.config,"postcopy-preempt" , true);
@@ -454,8 +438,6 @@ static void test_precopy_unix_tls_psk(char *name, MigrateCommon *args) args->connect_uri = uri; args->listen_uri = uri; - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match;test_precopy_tls_psk_common (args, &tls_psk_match); }
@@ -468,8 +450,6 @@ static void test_precopy_unix_tls_x509_default_host(char *name, args->connect_uri = uri; args->listen_uri = uri; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_default_host; args->result =MIG_TEST_FAIL_DEST_QUIT_ERR ; args->start.hide_stderr = true;
@@ -484,8 +464,6 @@ static void test_precopy_unix_tls_x509_override_host(char *name, args->connect_uri = uri; args->listen_uri = uri; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_override_host;test_precopy_tls_x509_common (args, &tls_x509_override_host); }
@@ -494,8 +472,6 @@ static void test_precopy_unix_tls_x509_override_host(char *name,static void test_precopy_tcp_tls_psk_match (char *name,MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_match;test_precopy_tls_psk_common (args, &tls_psk_match); }
@@ -503,8 +479,6 @@ static void test_precopy_tcp_tls_psk_match(char *name, MigrateCommon *args)static void test_precopy_tcp_tls_psk_mismatch (char *name,MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_psk_common; - args->start_hook_data = &tls_psk_mismatch; args->result =MIG_TEST_FAIL ; args->start.hide_stderr = true;
@@ -524,8 +498,6 @@ static void test_precopy_tcp_no_tls(char *name, MigrateCommon *args)static void test_precopy_tcp_tls_no_hostname (char *name,MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_no_host; args->result =MIG_TEST_FAIL_DEST_QUIT_ERR ; args->start.hide_stderr = true;
@@ -538,8 +510,6 @@ static void test_precopy_tcp_tls_x509_default_host(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_default_host;test_precopy_tls_x509_common (args, &tls_x509_default_host); }
@@ -548,8 +518,6 @@ static void test_precopy_tcp_tls_x509_override_host(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_override_host;test_precopy_tls_x509_common (args, &tls_x509_override_host); }
@@ -558,8 +526,6 @@ static void test_precopy_tcp_tls_x509_mismatch_host(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_mismatch_host; args->result =MIG_TEST_FAIL_DEST_QUIT_ERR ; args->start.hide_stderr = true;
@@ -571,8 +537,6 @@ static void test_precopy_tcp_tls_x509_friendly_client(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &x509_friendly_client;test_precopy_tls_x509_common (args, &x509_friendly_client); }
@@ -581,8 +545,6 @@ static void test_precopy_tcp_tls_x509_hostile_client(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_hostile_client; args->result =MIG_TEST_FAIL ; args->start.hide_stderr = true;
@@ -594,8 +556,6 @@ static void test_precopy_tcp_tls_x509_allow_anon_client(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_allow_anon_client;test_precopy_tls_x509_common (args, &tls_x509_allow_anon_client); }
@@ -604,8 +564,6 @@ static void test_precopy_tcp_tls_x509_reject_anon_client(char *name, MigrateCommon *args) { args->listen_uri ="tcp:127.0.0.1:0" ; - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_reject_anon_client; args->result =MIG_TEST_FAIL ; args->start.hide_stderr = true;
@@ -679,8 +637,6 @@ static void test_multifd_tcp_tls_x509_mismatch_host(char *name,* to load migration state, and thus just aborts the migration * without exiting. */ - args->start_hook_full = migrate_hook_start_tls_x509_common; - args->start_hook_data = &tls_x509_mismatch_host; args->result =MIG_TEST_FAIL ; args->listen_uri ="tcp:127.0.0.1:0" ;
Signature · 1 line
2.51.0
Quoted 84 lines · Fabiano Rosas
Hi, the scope of this series is the same as the previous versions, but to be explicit, these are various parts of which it's comprised:
1) Remove duplication of migration parameters documentation in migration.json.
2) Merge migration capabilities and parameters in MigrationState (as visible internally in migration code).
3) Deprecate migration capabilities QMP commands. Functionality previously provided by "capabilities" commands are now provided by "parameters" commands.
4) Introduce new 'config' argument to migration commands taking the entire set of options to use for a migration. Obsoletes the usage of migrate-set-parameters, except for "runtime" options, which are as of yet uncovered by this proposal.
5) Adapt all migration-test(s) to use the new config API exclusively.
Notable changes in this v3:
- Added the setter for the new StrOrNull qdev property
- Move the visitor code into a newQAPI_MERGEmacro
- Converted all tests to use config
- Unfortunate side-quest: rework the TLS test hooks to support setting options beforemigrate_start.CI run: https://gitlab.com/farosas/qemu/-/pipelines/2216127826
v2:
https://lore.kernel.org/r/[email protected]v1:
https://lore.kernel.org/r/[email protected]RFC:
https://lore.kernel.org/r/[email protected]Fabiano Rosas (51):
migration: Fix leak ofblock_bitmap_mapping
migration: Fix leak ofcpr_exec_command
migration: Add a qdev property for StrOrNull tests/qtest/migration: Add a NULL parameters test for TLS
migration: Normalize tls arguments
migration: Remove MigrateSetParameters
qapi/migration: Don't document MigrationParameter
migration: Run a post update routine after setting parameters
migration: Add a flag to track block-bitmap-mapping input
migration: Remove checks fors->parametershas_* fields
migration: Do away with usage ofQERR_INVALID_PARAMETER_VALUE
migration: Extract code to mark all parameters as present
migration: UseQAPI_CLONE_MEMBERSinquery_migrate_parameters
migration: UseQAPI_CLONE_MEMBERSinmigrate_params_test_apply
migration: UseQAPI_CLONE_MEMBERSinmigrate_params_apply
qapi: AddQAPI_MERGE
migration: UseQAPI_MERGEinmigrate_params_test_apply
migration: Cleanuphmp_info_migrate_parameters
migration: Add capabilities into MigrationParameters
migration: Removes->capabilities
qapi/migration: Deprecate capabilities commands
migration: Store the initial values used fors->parameters
migration: Allow migrate commands to provide the migration config
migration: Allow incoming cmdline to take config tests/qtest/migration: Pass MigrateCommon into test functions tests/qtest/migration: Pass MigrateStart into cancel tests tests/qtest/migration: Fix misuse oflisten_uritests/qtest/migration: Stop invokingmigrate_incomingfrom hooks tests/qtest/migration: Add config QDict tests/qtest/migration: Add temporary code to toggle usage of config tests/qtest/migration: Add a function for default capabilities tests/qtest/migration: Adapt convergence routines to config tests/qtest/migration: Adapt the incoming cmdline for config passing tests/qtest/migration: Usemigrate_incoming_qmpwhere possible tests/qtest/migration: Add a config parameter tomigrate_qmpfunctions tests/qtest/migration: Move tls hook data out of specific hooks tests/qtest/migration: Add new hook with data tests/qtest/migration: TLS x509: Refactor to use full hook tests/qtest/migration: TLS x509: Add init/cleanup routines tests/qtest/migration: TLS PSK: Refactor to use full hook tests/qtest/migration: TLS PSK: Add init/cleanup routines tests/qtest/migration: Remove multifd compression hook tests/qtest/migration: Convert postcopy tests to use config tests/qtest/migration: Convert TLS PSK tests to use config
Quoted 8 lines
tests/qtest/migration: Convert TLS x509 tests to use config tests/qtest/migration: Convert compression tests to use config tests/qtest/migration: Convert file tests to use config tests/qtest/migration: Convert misc-tests to use config tests/qtest/migration: Convert precopy tests to use config tests/qtest/migration: Remove
migrate_set_capabilitiesand code around
it
tests/qtest/migration: Further simplify TLS tests
I'll keep reviewing the rest test changes.. while I've queued patches 1-13,25,26 for the upcoming pull for qemu 11.0. Please shoot if there's any concerns.
Thanks,
Signature · 1 line
Peter Xu