From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH 19/21] migration: Allow migrate commands to provide the migration config
Date: Fri, 06 Jun 2025 17:23:18 -0300 [thread overview]
Message-ID: <874iwswrex.fsf@suse.de> (raw)
In-Reply-To: <aENBda_y3v3y4ptS@x1.local>
Peter Xu <peterx@redhat.com> writes:
> On Mon, Jun 02, 2025 at 10:38:08PM -0300, Fabiano Rosas wrote:
>> Allow the migrate and migrate_incoming commands to pass the migration
>> configuration options all at once, dispensing the use of
>> migrate-set-parameters and migrate-set-capabilities.
>>
>> The motivation of this is to simplify the interface with the
>> management layer and avoid the usage of several command invocations to
>> configure a migration. It also avoids stale parameters from a previous
>> migration to influence the current migration.
>>
>> The options that are changed during the migration can still be set
>> with the existing commands.
>>
>> The order of precedence is:
>>
>> 'config' argument > -global cmdline > defaults (migration_properties)
>
> Could we still keep the QMP migrate-set-parameters values?
>
> 'config' argument > QMP setups using migrate-set-parameters >
> -global cmdline > defaults (migration_properties)
>
That's the case. I failed to mention it in the commit message. IOW it
behaves just like today, but the new 'config' way takes precedence over
all.
> I asked this before, maybe I forgot the answer..
>
>>
>> I.e. the config takes precedence over all, values not present in the
>> config assume the default values. The (debug) -global command line
>> option allows the defaults to be overridden.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>> migration/migration-hmp-cmds.c | 5 +++--
>> migration/migration.c | 29 ++++++++++++++++++++++++++---
>> migration/migration.h | 1 +
>> migration/options.c | 30 ++++++++++++++++++++++++++++++
>> migration/options.h | 3 +++
>> qapi/migration.json | 25 +++++++++++++++++++++++--
>> system/vl.c | 3 ++-
>> 7 files changed, 88 insertions(+), 8 deletions(-)
>>
>> diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
>> index a8c3515e9d..38b289e8d8 100644
>> --- a/migration/migration-hmp-cmds.c
>> +++ b/migration/migration-hmp-cmds.c
>> @@ -575,7 +575,7 @@ void hmp_migrate_incoming(Monitor *mon, const QDict *qdict)
>> }
>> QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel));
>>
>> - qmp_migrate_incoming(NULL, true, caps, true, false, &err);
>> + qmp_migrate_incoming(NULL, true, caps, NULL, true, false, &err);
>> qapi_free_MigrationChannelList(caps);
>>
>> end:
>> @@ -952,7 +952,8 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
>> }
>> QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel));
>>
>> - qmp_migrate(NULL, true, caps, false, false, true, resume, &err);
>> + qmp_migrate(NULL, true, caps, NULL, false, false, true, resume,
>> + &err);
>> if (hmp_handle_error(mon, err)) {
>> return;
>> }
>> diff --git a/migration/migration.c b/migration/migration.c
>> index 75c4ec9a95..7b450b8836 100644
>> --- a/migration/migration.c
>> +++ b/migration/migration.c
>> @@ -335,6 +335,7 @@ void migration_object_init(void)
>> current_incoming->exit_on_error = INMIGRATE_DEFAULT_EXIT_ON_ERROR;
>>
>> migration_object_check(current_migration, &error_fatal);
>> + migrate_params_store_defaults(current_migration);
>>
>> ram_mig_init();
>> dirty_bitmap_mig_init();
>> @@ -1916,13 +1917,24 @@ void migrate_del_blocker(Error **reasonp)
>>
>> void qmp_migrate_incoming(const char *uri, bool has_channels,
>> MigrationChannelList *channels,
>> - bool has_exit_on_error, bool exit_on_error,
>> - Error **errp)
>> + MigrationParameters *config, bool has_exit_on_error,
>> + bool exit_on_error, Error **errp)
>> {
>> Error *local_err = NULL;
>> static bool once = true;
>> + MigrationState *s = migrate_get_current();
>> MigrationIncomingState *mis = migration_incoming_get_current();
>>
>> + if (config) {
>> + /*
>> + * If a config was provided, all options set previously get
>> + * ignored.
>> + */
>> + if (!migrate_params_override(s, config, errp)) {
>> + return;
>> + }
>> + }
>> +
>> if (!once) {
>> error_setg(errp, "The incoming migration has already been started");
>> return;
>> @@ -2182,7 +2194,8 @@ static gboolean qmp_migrate_finish_cb(QIOChannel *channel,
>> }
>>
>> void qmp_migrate(const char *uri, bool has_channels,
>> - MigrationChannelList *channels, bool has_detach, bool detach,
>> + MigrationChannelList *channels,
>> + bool has_detach, bool detach, MigrationParameters *config,
>> bool has_resume, bool resume, Error **errp)
>> {
>> bool resume_requested;
>> @@ -2193,6 +2206,16 @@ void qmp_migrate(const char *uri, bool has_channels,
>> MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] = { NULL };
>> MigrationChannel *cpr_channel = NULL;
>>
>> + if (config) {
>> + /*
>> + * If a config was provided, all options set previously get
>> + * ignored.
>> + */
>> + if (!migrate_params_override(s, config, errp)) {
>> + return;
>> + }
>> + }
>> +
>> /*
>> * Having preliminary checks for uri and channel
>> */
>> diff --git a/migration/migration.h b/migration/migration.h
>> index 993d51aedd..49761f4699 100644
>> --- a/migration/migration.h
>> +++ b/migration/migration.h
>> @@ -319,6 +319,7 @@ struct MigrationState {
>>
>> /* params from 'migrate-set-parameters' */
>> MigrationParameters parameters;
>> + MigrationParameters defaults;
>
> This is also prone to be a pointer; I still think embeded qapi objects are
> too error prone. Since it's new, make it a pointer from start?
>
Ok.
>>
>> MigrationStatus state;
>>
>> diff --git a/migration/options.c b/migration/options.c
>> index fa3f7035c8..dd2288187d 100644
>> --- a/migration/options.c
>> +++ b/migration/options.c
>> @@ -1333,6 +1333,36 @@ static void migrate_params_apply(MigrationParameters *params)
>> params->block_bitmap_mapping);
>> }
>>
>> +void migrate_params_store_defaults(MigrationState *s)
>> +{
>> + /*
>> + * The defaults set for each qdev property in migration_properties
>> + * will be stored as the default values for each migration
>> + * parameter. For debugging, using -global can override the
>> + * defaults.
>> + */
>> + QAPI_CLONE_MEMBERS(MigrationParameters, &s->defaults, &s->parameters);
>> +}
>> +
>> +bool migrate_params_override(MigrationState *s, MigrationParameters *new,
>> + Error **errp)
>> +{
>> + ERRP_GUARD();
>> +
>> + assert(bql_locked());
>> +
>> + /* reset to default parameters */
>> + migrate_params_apply(&s->defaults);
>> +
>> + /* overwrite with the new ones */
>> + qmp_migrate_set_parameters(new, errp);
>> + if (*errp) {
>> + return false;
>> + }
>> +
>> + return true;
>> +}
>> +
>> void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
>> {
>> MigrationParameters *tmp = g_new0(MigrationParameters, 1);
>> diff --git a/migration/options.h b/migration/options.h
>> index fcfd120cd7..3630c2a0dd 100644
>> --- a/migration/options.h
>> +++ b/migration/options.h
>> @@ -83,4 +83,7 @@ void migrate_capability_set_compat(MigrationParameters *params, int i,
>> void migrate_capabilities_set_compat(MigrationParameters *params,
>> MigrationCapabilityStatusList *caps);
>> bool migrate_caps_check(MigrationParameters *new, Error **errp);
>> +void migrate_params_store_defaults(MigrationState *s);
>> +bool migrate_params_override(MigrationState *s, MigrationParameters *new,
>> + Error **errp);
>> #endif
>> diff --git a/qapi/migration.json b/qapi/migration.json
>> index 7282e4b9eb..64a92d8d28 100644
>> --- a/qapi/migration.json
>> +++ b/qapi/migration.json
>> @@ -1474,9 +1474,16 @@
>> #
>> # @resume: resume one paused migration, default "off". (since 3.0)
>> #
>> +# @config: migration configuration options, previously set via
>> +# @migrate-set-parameters and @migrate-set-capabilities. (since
>> +# 10.1)
>> +#
>> # Features:
>> #
>> # @deprecated: Argument @detach is deprecated.
>> +# @config: Indicates this command can receive the entire migration
>> +# configuration via the @config field, dispensing the use of
>> +# @migrate-set-parameters.
>> #
>> # Since: 0.14
>> #
>> @@ -1538,7 +1545,9 @@
>> 'data': {'*uri': 'str',
>> '*channels': [ 'MigrationChannel' ],
>> '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] },
>> - '*resume': 'bool' } }
>> + '*config': 'MigrationParameters',
>> + '*resume': 'bool' },
>> + 'features': [ 'config' ] }
>>
>> ##
>> # @migrate-incoming:
>> @@ -1557,6 +1566,16 @@
>> # error details could be retrieved with query-migrate.
>> # (since 9.1)
>> #
>> +# @config: migration configuration options, previously set via
>> +# @migrate-set-parameters and @migrate-set-capabilities. (since
>> +# 10.1)
>> +#
>> +# Features:
>> +#
>> +# @config: Indicates this command can receive the entire migration
>> +# configuration via the @config field, dispensing the use of
>> +# @migrate-set-parameters.
>> +#
>> # Since: 2.3
>> #
>> # .. admonition:: Notes
>> @@ -1610,7 +1629,9 @@
>> { 'command': 'migrate-incoming',
>> 'data': {'*uri': 'str',
>> '*channels': [ 'MigrationChannel' ],
>> - '*exit-on-error': 'bool' } }
>> + '*config': 'MigrationParameters',
>> + '*exit-on-error': 'bool' },
>> + 'features': [ 'config' ] }
>>
>> ##
>> # @xen-save-devices-state:
>> diff --git a/system/vl.c b/system/vl.c
>> index 3b7057e6c6..b29fd24d08 100644
>> --- a/system/vl.c
>> +++ b/system/vl.c
>> @@ -2823,7 +2823,8 @@ void qmp_x_exit_preconfig(Error **errp)
>> g_new0(MigrationChannelList, 1);
>>
>> channels->value = incoming_channels[MIGRATION_CHANNEL_TYPE_MAIN];
>> - qmp_migrate_incoming(NULL, true, channels, true, true, &local_err);
>> + qmp_migrate_incoming(NULL, true, channels, NULL, true, true,
>> + &local_err);
>> if (local_err) {
>> error_reportf_err(local_err, "-incoming %s: ", incoming);
>> exit(1);
>> --
>> 2.35.3
>>
next prev parent reply other threads:[~2025-06-06 20:24 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 1:37 [PATCH 00/21] migration: Unify capabilities and parameters Fabiano Rosas
2025-06-03 1:37 ` [PATCH 01/21] migration: Normalize tls arguments Fabiano Rosas
2025-06-05 20:51 ` Peter Xu
2025-06-06 13:48 ` Fabiano Rosas
2025-06-25 9:41 ` Markus Armbruster
2025-06-25 17:17 ` Fabiano Rosas
2025-06-26 9:38 ` Markus Armbruster
2025-06-26 14:51 ` Fabiano Rosas
2025-06-27 7:10 ` Markus Armbruster
2025-06-27 20:28 ` Fabiano Rosas
2025-07-01 7:08 ` Markus Armbruster
2025-07-01 9:05 ` Daniel P. Berrangé
2025-06-03 1:37 ` [PATCH 02/21] migration: Remove MigrateSetParameters Fabiano Rosas
2025-06-05 20:58 ` Peter Xu
2025-06-25 11:31 ` Markus Armbruster
2025-06-25 17:21 ` Fabiano Rosas
2025-06-26 9:40 ` Markus Armbruster
2025-06-03 1:37 ` [PATCH 03/21] qapi/migration: Don't document MigrationParameter Fabiano Rosas
2025-06-05 21:00 ` Peter Xu
2025-06-25 12:04 ` Markus Armbruster
2025-06-25 12:22 ` Markus Armbruster
2025-06-25 17:29 ` Fabiano Rosas
2025-06-03 1:37 ` [PATCH 04/21] migration: Run a post update routine after setting parameters Fabiano Rosas
2025-06-03 1:37 ` [PATCH 05/21] migration: Add a flag to track block-bitmap-mapping input Fabiano Rosas
2025-06-06 15:03 ` Peter Xu
2025-06-06 15:43 ` Fabiano Rosas
2025-06-06 17:44 ` Peter Xu
2025-06-06 18:38 ` Fabiano Rosas
2025-06-03 1:37 ` [PATCH 06/21] migration: Remove checks for s->parameters has_* fields Fabiano Rosas
2025-06-06 15:13 ` Peter Xu
2025-06-03 1:37 ` [PATCH 07/21] migration: Set block_bitmap_mapping unconditionally in query-migrate-parameters Fabiano Rosas
2025-06-03 1:37 ` [PATCH 08/21] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Fabiano Rosas
2025-06-06 15:17 ` Peter Xu
2025-06-03 1:37 ` [PATCH 09/21] migration: Extract code to mark all parameters as present Fabiano Rosas
2025-06-06 15:26 ` Peter Xu
2025-06-06 15:51 ` Fabiano Rosas
2025-06-06 17:48 ` Peter Xu
2025-06-03 1:37 ` [PATCH 10/21] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Fabiano Rosas
2025-06-06 15:29 ` Peter Xu
2025-06-06 15:53 ` Fabiano Rosas
2025-06-12 20:58 ` Fabiano Rosas
2025-06-12 21:27 ` Peter Xu
2025-06-13 12:30 ` Fabiano Rosas
2025-06-03 1:38 ` [PATCH 11/21] migration: Use QAPI_CLONE_MEMBERS in migrate_params_test_apply Fabiano Rosas
2025-06-03 1:38 ` [PATCH 12/21] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Fabiano Rosas
2025-06-03 1:38 ` [PATCH 13/21] migration: Use visitors in migrate_params_test_apply Fabiano Rosas
2025-06-03 1:38 ` [PATCH 14/21] migration: Cleanup hmp_info_migrate_parameters Fabiano Rosas
2025-06-06 18:52 ` Peter Xu
2025-06-03 1:38 ` [PATCH 15/21] migration: Add capabilities into MigrationParameters Fabiano Rosas
2025-06-06 19:01 ` Peter Xu
2025-06-03 1:38 ` [PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities Fabiano Rosas
2025-06-03 9:01 ` Daniel P. Berrangé
2025-06-06 13:53 ` Fabiano Rosas
2025-06-03 1:38 ` [PATCH 17/21] migration: Remove s->capabilities Fabiano Rosas
2025-06-06 19:16 ` Peter Xu
2025-06-03 1:38 ` [PATCH 18/21] qapi/migration: Deprecate capabilities commands Fabiano Rosas
2025-06-06 19:16 ` Peter Xu
2025-06-03 1:38 ` [PATCH 19/21] migration: Allow migrate commands to provide the migration config Fabiano Rosas
2025-06-03 9:03 ` Daniel P. Berrangé
2025-06-06 19:28 ` Peter Xu
2025-06-06 20:23 ` Fabiano Rosas [this message]
2025-06-06 20:50 ` Peter Xu
2025-06-09 14:37 ` Fabiano Rosas
2025-06-09 15:51 ` Peter Xu
2025-06-09 16:13 ` Daniel P. Berrangé
2025-06-09 16:49 ` Peter Xu
2025-06-09 18:17 ` Fabiano Rosas
2025-06-09 18:02 ` Fabiano Rosas
2025-06-09 19:05 ` Peter Xu
2025-06-09 19:41 ` Fabiano Rosas
2025-06-09 20:35 ` Peter Xu
2025-06-10 20:55 ` Fabiano Rosas
2025-06-10 21:27 ` Peter Xu
2025-06-09 15:03 ` Daniel P. Berrangé
2025-06-09 15:33 ` Peter Xu
2025-06-09 15:43 ` Daniel P. Berrangé
2025-06-09 15:53 ` Peter Xu
2025-06-09 15:58 ` Peter Xu
2025-06-09 16:15 ` Daniel P. Berrangé
2025-06-09 16:41 ` Peter Xu
2025-06-03 1:38 ` [PATCH 20/21] libqtest: Add a function to check whether a QMP command supports a feature Fabiano Rosas
2025-06-03 1:38 ` [PATCH 21/21] tests/qtest/migration: Add a test for config passing Fabiano Rosas
2025-06-12 6:41 ` [PATCH 00/21] migration: Unify capabilities and parameters Mario Casquero
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=874iwswrex.fsf@suse.de \
--to=farosas@suse.de \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=peterx@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.