Skip to content

RFC migration: Unify capabilities and parameters

Fabiano Rosas qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest13 patches 30 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13migration: Fix latent bug in migrate_params_test_apply()migration/options.c+5 -00 replies
2/13migration: Normalize tls argumentsmigration/options.c migration/tls.c+44 -391 reply
3/13migration: Run a post update routine after setting parametersmigration/options.c migration/ram.c+30 -111 reply
4/13migration: Fix parameter validationmigration/options.c+2 -05 replies
5/13migration: Reduce a bit of duplication in migration.jsonqapi/migration.json+108 -2507 replies
6/13migration: Remove the parameters copy during validationmigration/migration.c migration/options.c+67 -1300 replies
7/13migration: Introduce new MigrationConfig structureqapi/migration.json+160 -33 replies
8/13migration: Replace s->parameters with s->configmigration/migration.c migration/migration.h migration/options.c +2 more+192 -2200 replies
9/13migration: Do away with usage of QERR_INVALID_PARAMETER_VALUEmigration/migration.c migration/options.c migration/page_cache.c +1 more+24 -440 replies
10/13migration: Replace s->capabilities with s->configmigration/migration.c migration/migration.h migration/options.c +2 more+227 -1630 replies
11/13migration: Merge parameters and capability checksmigration/migration.c migration/options.c migration/options.h+272 -2630 replies
12/13migration: Add query/set commands for MigrationConfigmigration/options.c migration/options.h qapi/migration.json+67 -12 replies
13/13migration: Allow migrate commands to provide the migration configmigration/migration-hmp-cmds.c migration/migration.c qapi/migration.json +1 more+19 -72 replies

Reviews trailers per patch

2 of 13 patches have a Reviewed-by or Acked-by.

PatchFabiano RosasPeter Xu
1/13R-b
2/13
3/13R-b
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 00/13] migration: Unify capabilities and parameters

Hi everyone, I did a cleanup (if it can be called that) of the user input validation for capabilities and parameters and turned the two concepts into a single 'options' to be stored in a MigrationConfig object.

RFC mostly because this idea exposes (pre-existing) issues around how to validate capabilities that are mutually excludent and options that need to be enabled together.

I'd also like some feedback on what approach to take regarding compatibility.

Let me know what you think. I know it's a lot to look at, any comments are welcomed and don't worry on trying to cover everything. This is long-term work. Thank you.

The reasons for this work are:
------------------------------

Capabilities are just boolean parameters that can only be set before migration. For the majority of the code there's no distinction between the two.

Having a single structure allows the qmp_migrate command to receive the migration configuration all at once:

{ 'command': 'migrate',
'data': {'*uri': 'str',
'*channels': [ 'MigrationChannel' ],
+ '*config': 'MigrationConfig',

           '*detach': 'bool', '*resume': 'bool' } }

+{ 'struct': 'MigrationConfig',
+ 'data': { '*announce-initial': 'size',
+ '*announce-max': 'size',
+ ... <-- all parameters and capabilities as optional
+} }

(optionally fold 'detach' and 'resume' into MigrationConfig)

Other benefits of a single configuration struct:

- allows the removal of two commands:
migrate-set-capabilities/query-capabilities which simplifies the user interface (migrate-set-parameters, or similar, is still required for options that need to be adjusted during migration);

- removes (some of) the triplication in migration.json;

- simplifies the (future) work of implementing a handshake feature for
migration: only one structure to negotiate over and less reliance on commands other than 'migrate'.

The major changes in this series are:
-------------------------------------

- Add a (QAPI) type hierarchy:

MigrationConfigBase
(most config options)
|
+-------------------------|-------------------------+
| | |
MigrationConfig MigrationParameters MigrateSetParameters

 (internal use, s->config,   (compat with               (compat with
 new query/set-config)       query-migrate-parameters)  migrate-set-parameters)

- Remove migrate_params_test_apply. This function duplicates a lot of code;

- Add compatibility routines to convert from the existing QMP user input into the new MigrationConfig for internal use;

- Merge capabilities and parameters validation into one function;

- Convert qmp_migrate and qmp_migrate_incoming to use the new structure.

Open questions:
---------------

- Deprecations/compat?

I think we should deprecate migrate-set/query-capabilities and everything to do with capabilities (specifically the validation in the JSON at the end of the stream).

For migrate-set/query-parameters, we could probably keep it around indefinitely, but it'd be convenient to introduce new commands so we can give them new semantics.

- How to restrict the options that should not be set when the migration is in progress?

i.e.:
all options can be set before migration (initial config) some options can be set during migration (runtime)

I thought of adding another type at the top of the hierarchy, with just the options allowed to change at runtime, but that doesn't really stop the others being also set at runtime. I'd need a way to have a set of options that are rejected 'if migration_is_running()', without adding more duplication all around.

- What about savevm?

None of this solves the issue of random caps/params being set before calling savevm. We still need to special-case savevm and reject everything. Unless we entirely deprecate setting initial options via set-parameters (or set-config) and require all options to be set as savevm (and migrate) arguments.

- HMP?

Can we convert the strings passed via hmp_set_parameters without having an enum of parameters? Duplication problem again.

- incoming defer?

It seems we cannot do the final step of removing migrate-set-capabilites before we have a form of handshake implemented. That would take the config from qmp_migrate on source and send it to the destination for negotiation.

- last but definitely not least:

Changing caps from a list of bools into struct members complicates the validation because some caps must be checked against every other cap already set. And the user could be playing games with switching caps on and off, so there's a lot of redundant checking the must be made. The current code already has a bunch of gaps in that regard.

For this series I opted to not check has_* fields for capabilities, i.e. to validate them all every time migrate_config_check() is called.

Fabiano Rosas (12):
migration: Normalize tls arguments
migration: Run a post update routine after setting parameters
migration: Fix parameter validation
migration: Reduce a bit of duplication in migration.json
migration: Remove the parameters copy during validation
migration: Introduce new MigrationConfig structure
migration: Replace s->parameters with s->config
migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE
migration: Replace s->capabilities with s->config
migration: Merge parameters and capability checks [PoC] migration: Add query/set commands for MigrationConfig [PoC] migration: Allow migrate commands to provide the migration
config

Markus Armbruster (1):
migration: Fix latent bug in migrate_params_test_apply()

 migration/migration-hmp-cmds.c |    5 +-
 migration/migration.c          |   52 +-
 migration/migration.h          |    5 +-
 migration/options.c            | 1386 ++++++++++++++++----------------
 migration/options.h            |   25 +-
 migration/page_cache.c         |    6 +-
 migration/ram.c                |    9 +-
 migration/savevm.c             |    8 +-
 migration/tls.c                |    2 +-
 qapi/migration.json            |  571 +++++++------
 system/vl.c                    |    3 +-
 11 files changed, 1079 insertions(+), 993 deletions(-)
Signature · 1 line
2.35.3