From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, berrange@redhat.com, armbru@redhat.com,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3 24/51] migration: Allow incoming cmdline to take config
Date: Wed, 17 Dec 2025 10:34:05 -0500 [thread overview]
Message-ID: <aULNbapP47hK1ApN@x1.local> (raw)
In-Reply-To: <20251215220041.12657-25-farosas@suse.de>
On Mon, Dec 15, 2025 at 07:00:10PM -0300, Fabiano Rosas wrote:
> When -incoming "defer" is not used, the incoming migration is invoked
> directly by the command line parsing code in vl.c. Allow the migration
> config to be passed via the -incoming command line option so that
> invocation of qmp_migrate_incoming() can receive it.
>
> E.g.
> -incoming '{"tls-creds": "tlscredsx509server0", "tls-hostname": "qemu.org"}'
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> This is useful for the tests. If we want to declare that
> config-passing only works with -incoming defer, that's fine with me.
This can also be done with -global migration.xxx, right? Except that
-global can also work for either src or dest, I thought that was a bonus as
more flexible.
Maybe I overlooked some reasons from testing side?..
> ---
> system/vl.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 100 insertions(+), 12 deletions(-)
>
> diff --git a/system/vl.c b/system/vl.c
> index d09dc9a61c..ac44933a11 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -169,6 +169,9 @@ static const char *mem_path;
> static const char *incoming;
> static const char *incoming_str[MIGRATION_CHANNEL_TYPE__MAX];
> static MigrationChannel *incoming_channels[MIGRATION_CHANNEL_TYPE__MAX];
> +static MigrationParameters *migration_config;
> +static Error *migration_channel_err;
> +static Error *migration_config_err;
> static const char *loadvm;
> static const char *accelerators;
> static bool have_custom_ram_size;
> @@ -1825,28 +1828,102 @@ static void object_option_add_visitor(Visitor *v)
> QTAILQ_INSERT_TAIL(&object_opts, opt, next);
> }
>
> -static void incoming_option_parse(const char *str)
> +/*
> + * Either "defer" or a proper uri, whether plain string or a json
> + * representation of MigrationChannel.
> + */
> +static bool incoming_option_parse_channels(const char *str, Error **errp)
> {
> MigrationChannelType type = MIGRATION_CHANNEL_TYPE_MAIN;
> - MigrationChannel *channel;
> + MigrationChannel *channel = NULL;
> Visitor *v;
>
> - if (!strcmp(str, "defer")) {
> - channel = NULL;
> - } else if (migrate_is_uri(str)) {
> + if (g_str_equal(str, "defer")) {
> + incoming_str[type] = str;
> + return true;
> + }
> +
> + if (migrate_is_uri(str)) {
> migrate_uri_parse(str, &channel, &error_fatal);
> } else {
> v = qobject_input_visitor_new_str(str, "channel-type", &error_fatal);
> - visit_type_MigrationChannel(v, NULL, &channel, &error_fatal);
> + if (v && !visit_type_MigrationChannel(v, NULL, &channel, errp)) {
> + visit_free(v);
> + return false;
> + }
> visit_free(v);
> + }
> +
> + if (channel) {
> type = channel->channel_type;
> + /* New incoming spec replaces the previous */
> + qapi_free_MigrationChannel(incoming_channels[type]);
> + incoming_channels[type] = channel;
> + incoming_str[type] = str;
> }
>
> - /* New incoming spec replaces the previous */
> - qapi_free_MigrationChannel(incoming_channels[type]);
> - incoming_channels[type] = channel;
> - incoming_str[type] = str;
> incoming = incoming_str[MIGRATION_CHANNEL_TYPE_MAIN];
> + return true;
> +}
> +
> +/*
> + * The migration configuration object in JSON form.
> + */
> +static bool incoming_option_parse_config(const char *str, Error **errp)
> +{
> + MigrationParameters *config = NULL;
> + Visitor *v;
> +
> + v = qobject_input_visitor_new_str(str, "config", &error_fatal);
> + if (v && !visit_type_MigrationParameters(v, NULL, &config, errp)) {
> + visit_free(v);
> + return false;
> + }
> +
> + if (config) {
> + /* later incoming configs replace the previous ones */
> + migration_config = config;
> + }
> +
> + visit_free(v);
> + return true;
> +}
> +
> +static void incoming_option_parse(const char *str)
> +{
> + /*
> + * Independent Error objects because we don't know whether the
> + * input is meant to be the channels or the config. The parsing
> + * may fail for one and succeed for the other.
> + */
> + g_autoptr(Error) channel_err = NULL;
> + g_autoptr(Error) config_err = NULL;
> +
> + /*
> + * Skip if there's already an error for a previous -incoming
> + * instance.
> + */
> + if (migration_channel_err || migration_config_err) {
> + return;
> + }
> +
> + if (!migration_channel_err &&
> + incoming_option_parse_channels(str, &channel_err)) {
> + return;
> + }
> +
> + if (!migration_config_err &&
> + incoming_option_parse_config(str, &config_err)) {
> + return;
> + }
> +
> + if (channel_err) {
> + migration_channel_err = error_copy(channel_err);
> + error_prepend(&migration_channel_err, "-incoming %s: ", str);
> + } else if (config_err) {
> + migration_config_err = error_copy(config_err);
> + error_prepend(&migration_config_err, "-incoming %s: ", str);
> + }
> }
>
> static void object_option_parse(const char *str)
> @@ -2537,6 +2614,16 @@ static void qemu_validate_options(const QDict *machine_opts)
> exit(EXIT_FAILURE);
> }
>
> + if (migration_channel_err && !incoming) {
> + error_report_err(migration_config_err);
> + exit(EXIT_FAILURE);
> + }
> +
> + if (migration_config_err && !migration_config) {
> + error_report_err(migration_config_err);
> + exit(EXIT_FAILURE);
> + }
> +
> #ifdef CONFIG_CURSES
> if (is_daemonized() && dpy.type == DISPLAY_TYPE_CURSES) {
> error_report("curses display cannot be used with -daemonize");
> @@ -2824,13 +2911,14 @@ void qmp_x_exit_preconfig(Error **errp)
>
> if (incoming) {
> Error *local_err = NULL;
> +
> if (strcmp(incoming, "defer") != 0) {
> g_autofree MigrationChannelList *channels =
> g_new0(MigrationChannelList, 1);
>
> channels->value = incoming_channels[MIGRATION_CHANNEL_TYPE_MAIN];
> - qmp_migrate_incoming(NULL, true, channels, NULL, true, true,
> - &local_err);
> + qmp_migrate_incoming(NULL, true, channels, migration_config, true,
> + true, &local_err);
> if (local_err) {
> error_reportf_err(local_err, "-incoming %s: ", incoming);
> exit(1);
> --
> 2.51.0
>
--
Peter Xu
next prev parent reply other threads:[~2025-12-17 15:34 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 21:59 [PATCH v3 00/51] migration: Unify capabilities and parameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 01/51] migration: Fix leak of block_bitmap_mapping Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 02/51] migration: Fix leak of cpr_exec_command Fabiano Rosas
2025-12-16 16:48 ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 03/51] migration: Add a qdev property for StrOrNull Fabiano Rosas
2025-12-16 16:57 ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 04/51] tests/qtest/migration: Add a NULL parameters test for TLS Fabiano Rosas
2025-12-16 17:03 ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 05/51] migration: Normalize tls arguments Fabiano Rosas
2025-12-16 17:24 ` Peter Xu
2025-12-17 16:40 ` Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 06/51] migration: Remove MigrateSetParameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 07/51] qapi/migration: Don't document MigrationParameter Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 08/51] migration: Run a post update routine after setting parameters Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 09/51] migration: Add a flag to track block-bitmap-mapping input Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 10/51] migration: Remove checks for s->parameters has_* fields Fabiano Rosas
2025-12-16 18:50 ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 11/51] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Fabiano Rosas
2025-12-15 21:59 ` [PATCH v3 12/51] migration: Extract code to mark all parameters as present Fabiano Rosas
2025-12-16 18:56 ` Peter Xu
2025-12-15 21:59 ` [PATCH v3 13/51] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 14/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Fabiano Rosas
2025-12-16 19:31 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 15/51] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Fabiano Rosas
2025-12-16 20:26 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 16/51] qapi: Add QAPI_MERGE Fabiano Rosas
2025-12-16 20:30 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 17/51] migration: Use QAPI_MERGE in migrate_params_test_apply Fabiano Rosas
2025-12-16 20:47 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 18/51] migration: Cleanup hmp_info_migrate_parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 19/51] migration: Add capabilities into MigrationParameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 20/51] migration: Remove s->capabilities Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 21/51] qapi/migration: Deprecate capabilities commands Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 22/51] migration: Store the initial values used for s->parameters Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 23/51] migration: Allow migrate commands to provide the migration config Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 24/51] migration: Allow incoming cmdline to take config Fabiano Rosas
2025-12-17 15:34 ` Peter Xu [this message]
2025-12-15 22:00 ` [PATCH v3 25/51] tests/qtest/migration: Pass MigrateCommon into test functions Fabiano Rosas
2025-12-16 21:57 ` Peter Xu
2025-12-17 18:35 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 26/51] tests/qtest/migration: Pass MigrateStart into cancel tests Fabiano Rosas
2025-12-16 21:57 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 27/51] tests/qtest/migration: Fix misuse of listen_uri Fabiano Rosas
2025-12-17 15:30 ` Peter Xu
2025-12-17 16:59 ` Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 28/51] tests/qtest/migration: Stop invoking migrate_incoming from hooks Fabiano Rosas
2025-12-17 20:26 ` Peter Xu
2025-12-17 21:05 ` Fabiano Rosas
2025-12-17 21:24 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 29/51] tests/qtest/migration: Add config QDict Fabiano Rosas
2025-12-17 20:27 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 30/51] tests/qtest/migration: Add temporary code to toggle usage of config Fabiano Rosas
2025-12-18 17:34 ` Peter Xu
2025-12-18 19:41 ` Fabiano Rosas
2025-12-18 20:58 ` Peter Xu
2025-12-18 23:41 ` Fabiano Rosas
2025-12-19 15:09 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 31/51] tests/qtest/migration: Add a function for default capabilities Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 32/51] tests/qtest/migration: Adapt convergence routines to config Fabiano Rosas
2025-12-18 17:25 ` Peter Xu
2025-12-18 19:47 ` Fabiano Rosas
2025-12-18 21:08 ` Peter Xu
2025-12-18 23:28 ` Fabiano Rosas
2025-12-19 15:39 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 33/51] tests/qtest/migration: Adapt the incoming cmdline for config passing Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 34/51] tests/qtest/migration: Use migrate_incoming_qmp where possible Fabiano Rosas
2025-12-18 18:47 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 35/51] tests/qtest/migration: Add a config parameter to migrate_qmp functions Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 36/51] tests/qtest/migration: Move tls hook data out of specific hooks Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 37/51] tests/qtest/migration: Add new hook with data Fabiano Rosas
2025-12-18 19:05 ` Peter Xu
2025-12-18 21:43 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 38/51] tests/qtest/migration: TLS x509: Refactor to use full hook Fabiano Rosas
2025-12-18 19:15 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 39/51] tests/qtest/migration: TLS x509: Add init/cleanup routines Fabiano Rosas
2025-12-18 21:31 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 40/51] tests/qtest/migration: TLS PSK: Refactor to use full hook Fabiano Rosas
2025-12-18 21:33 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 41/51] tests/qtest/migration: TLS PSK: Add init/cleanup routines Fabiano Rosas
2025-12-18 21:48 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 42/51] tests/qtest/migration: Remove multifd compression hook Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 43/51] tests/qtest/migration: Convert postcopy tests to use config Fabiano Rosas
2025-12-18 22:03 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 44/51] tests/qtest/migration: Convert TLS PSK " Fabiano Rosas
2025-12-18 22:14 ` Peter Xu
2025-12-18 22:42 ` Fabiano Rosas
2025-12-19 15:59 ` Peter Xu
2025-12-15 22:00 ` [PATCH v3 45/51] tests/qtest/migration: Convert TLS x509 " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 46/51] tests/qtest/migration: Convert compression " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 47/51] tests/qtest/migration: Convert file " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 48/51] tests/qtest/migration: Convert misc-tests " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 49/51] tests/qtest/migration: Convert precopy tests " Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 50/51] tests/qtest/migration: Remove migrate_set_capabilities and code around it Fabiano Rosas
2025-12-15 22:00 ` [PATCH v3 51/51] tests/qtest/migration: Further simplify TLS tests Fabiano Rosas
2025-12-17 16:58 ` [PATCH v3 00/51] migration: Unify capabilities and parameters Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aULNbapP47hK1ApN@x1.local \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.