From: Markus Armbruster <armbru@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
Eric Blake <eblake@redhat.com>
Subject: Re: [PATCH 15/18] qapi/migration: Remove MigrationParameter
Date: Fri, 04 Sep 2026 11:07:10 +0200 [thread overview]
Message-ID: <87bjad9ygx.fsf@pond.sub.org> (raw)
In-Reply-To: <20260902221547.1812481-16-farosas@suse.de> (Fabiano Rosas's message of "Wed, 2 Sep 2026 19:15:43 -0300")
Fabiano Rosas <farosas@suse.de> writes:
> This enum is convenient in two ways (just how enums work):
>
> 1- It provides the number of migration parameters as its __MAX member.
>
> 2- It allows iterating over an integer range and get a migration
> parameter name string corresponding to that position in the enum.
>
> The migration code doesn't have the need for (2) anymore.
>
> Balancing the benefit of (1) versus the disadvantage of requiring
> migration.json to be updated in two different places whenever a
> parameter is added, experience shows that the latter churn is enough
> to decide to remove the enum.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
> migration/options.c | 6 +-----
> qapi/migration.json | 36 ------------------------------------
> 2 files changed, 1 insertion(+), 41 deletions(-)
>
> diff --git a/migration/options.c b/migration/options.c
> index 5d17acdd881..f988b181f0e 100644
> --- a/migration/options.c
> +++ b/migration/options.c
> @@ -1127,7 +1127,6 @@ static MigrationParameters *migrate_params_from_dict(QDict *d, Error **errp)
> */
> static void migrate_mark_all_params_present(MigrationParameters *p)
> {
> - int len, n_str_args = 3; /* tls-creds, tls-hostname, tls-authz */
> bool *has_fields[] = {
> &p->has_throttle_trigger_threshold, &p->has_cpu_throttle_initial,
> &p->has_cpu_throttle_increment, &p->has_cpu_throttle_tailslow,
> @@ -1144,10 +1143,7 @@ static void migrate_mark_all_params_present(MigrationParameters *p)
> &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command,
> };
>
> - len = ARRAY_SIZE(has_fields);
> - assert(len + n_str_args == MIGRATION_PARAMETER__MAX);
> -
> - for (int i = 0; i < len; i++) {
> + for (int i = 0; i < ARRAY_SIZE(has_fields); i++) {
> *has_fields[i] = true;
> }
> }
We lose the guard against forgetting to update has_fields[]. It's the
last user of MigrationParameter. I agree the guard doesn't justify
keeping MigrationParameter.
The guard is somewhat unclean anyway: it assumes the number of
MigrationParameter values matches the number of MigrationParameters
members.
Add a non-doc comment to MigrationParameters to remind of of updating
has_fields[] when it changes?
We don't have a convenient way to find the number of members.
> diff --git a/qapi/migration.json b/qapi/migration.json
> index b1eaf7b0545..78c6e933cf1 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -796,42 +796,6 @@
> 'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
> } }
>
> -##
> -# @MigrationParameter:
> -#
> -# Migration parameters enumeration. The enumeration values mirror the
> -# members of @MigrationParameters.
> -#
> -# Features:
> -#
> -# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and
> -# @x-vcpu-dirty-limit-period are experimental.
> -#
> -# Since: 2.4
> -##
> -{ 'enum': 'MigrationParameter',
> - 'data': ['announce-initial', 'announce-max',
> - 'announce-rounds', 'announce-step',
> - 'throttle-trigger-threshold',
> - 'cpu-throttle-initial', 'cpu-throttle-increment',
> - 'cpu-throttle-tailslow',
> - 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
> - 'avail-switchover-bandwidth', 'downtime-limit',
> - { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
> - 'multifd-channels',
> - 'xbzrle-cache-size', 'max-postcopy-bandwidth',
> - 'max-cpu-throttle', 'multifd-compression',
> - 'multifd-zlib-level', 'multifd-zstd-level',
> - 'multifd-qatzip-level',
> - 'block-bitmap-mapping',
> - { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
> - 'vcpu-dirty-limit',
> - 'mode',
> - 'zero-page-detection',
> - 'direct-io',
> - { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] },
> - 'cpr-exec-command'] }
> -
> ##
> # @migrate-set-parameters:
> #
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2026-09-04 9:08 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 22:15 [PATCH 00/18] migration: MigrationParameters changes Fabiano Rosas
2026-09-02 22:15 ` [PATCH 01/18] checkpatch: Fix checking of newlines in error messages Fabiano Rosas
2026-09-03 17:37 ` Peter Xu
2026-09-03 17:46 ` Fabiano Rosas
2026-09-03 18:00 ` Peter Xu
2026-09-03 18:35 ` Fabiano Rosas
2026-09-04 8:56 ` Markus Armbruster
2026-09-04 9:15 ` Peter Maydell
2026-09-04 12:09 ` Peter Xu
2026-09-04 14:00 ` Markus Armbruster
2026-09-02 22:15 ` [PATCH 02/18] migration/options.c: Don't export migrate_tls_opts_free Fabiano Rosas
2026-09-02 22:15 ` [PATCH 03/18] migration: Rename variables in qmp_migrate_set_parameters Fabiano Rosas
2026-09-03 17:44 ` Peter Xu
2026-09-02 22:15 ` [PATCH 04/18] migration: Use QAPI_CLONE_MEMBERS in migrate_params_apply Fabiano Rosas
2026-09-02 22:15 ` [PATCH 05/18] migration: Merge parameter structs instead of assigning one by one Fabiano Rosas
2026-09-03 18:20 ` Peter Xu
2026-09-03 19:03 ` Fabiano Rosas
2026-09-02 22:15 ` [PATCH 06/18] migration: Open code migrate_params_apply Fabiano Rosas
2026-09-02 22:15 ` [PATCH 07/18] migration: Stop freeing s->parameters members individually Fabiano Rosas
2026-09-02 22:15 ` [PATCH 08/18] migration: Use migrate_params_free during finalize Fabiano Rosas
2026-09-02 22:15 ` [PATCH 09/18] tests/qtest/migration: Add a test for HMP Fabiano Rosas
2026-09-03 20:38 ` Peter Xu
2026-09-03 20:42 ` Peter Xu
2026-09-02 22:15 ` [PATCH 10/18] migration: Validate that all params are set for query Fabiano Rosas
2026-09-03 18:59 ` Peter Xu
2026-09-04 15:11 ` Fabiano Rosas
2026-09-02 22:15 ` [PATCH 11/18] migration: Use keyval input visitor in HMP set command Fabiano Rosas
2026-09-03 19:44 ` Peter Xu
2026-09-03 20:24 ` Dr. David Alan Gilbert
2026-09-04 15:26 ` Peter Xu
2026-09-04 9:45 ` Markus Armbruster
2026-09-02 22:15 ` [PATCH 12/18] migration: Change HMP 'info migrate_parameters' output Fabiano Rosas
2026-09-03 20:25 ` Peter Xu
2026-09-02 22:15 ` [PATCH 13/18] migration: Use output visitor in info command Fabiano Rosas
2026-09-04 12:04 ` Peter Xu
2026-09-04 13:41 ` Fabiano Rosas
2026-09-04 14:54 ` Peter Xu
2026-09-04 15:08 ` Fabiano Rosas
2026-09-02 22:15 ` [PATCH 14/18] migration: Rewrite migrate_set_parameter_completion using QDict Fabiano Rosas
2026-09-03 20:23 ` Peter Xu
2026-09-02 22:15 ` [PATCH 15/18] qapi/migration: Remove MigrationParameter Fabiano Rosas
2026-09-04 9:07 ` Markus Armbruster [this message]
2026-09-04 12:24 ` Peter Xu
2026-09-04 13:49 ` Fabiano Rosas
2026-09-02 22:15 ` [PATCH 16/18] migration: Add capabilities into MigrationParameters Fabiano Rosas
2026-09-04 9:53 ` Markus Armbruster
2026-09-04 13:58 ` Fabiano Rosas
2026-09-02 22:15 ` [PATCH 17/18] migration: Remove s->capabilities Fabiano Rosas
2026-09-04 12:15 ` Peter Xu
2026-09-02 22:15 ` [PATCH 18/18] qapi/migration: Deprecate capabilities commands Fabiano Rosas
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=87bjad9ygx.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--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.