On Mon, Jun 02, 2025 at 10:37:55PM -0300, Fabiano Rosas wrote: > The migration parameters validation produces a temporary structure > which is the merge of the current parameter values (s->parameters, > MigrationParameters) with the new parameters set by the user > (MigrateSetParameters). > > When copying the values from s->parameters into the temporary > structure, the has_* fields are copied along, but when merging the > user-input values (MigrateSetParameters) they are not. > > During migrate_params_check(), only the parameters that have the > corresponding has_* field will be checked, so only the parameters that > were initialized in migrate_params_init() will be validated. > > This causes (almost) all of the migration parameters to be validated > every time a parameter is set, regardless of which fields the user > touched, but it also skips validation of any values that are not set > in migrate_params_init(). > > It's not clear what was the intention of the original code, whether to > validate all fields always, or only validate what the user input > changed. Since the current situation is closer to the former option, > make the choice of validating all parameters by removing the checks > for the has_* fields when validating. > > Note that bringing the user input into the temporary structure for > validation still needs to look at the has_* fields, otherwise any > parameters not set by the user (i.e. 0) would override the > corresponding value in s->parameters. > > Signed-off-by: Fabiano Rosas <faro...@suse.de>
Reviewed-by: Peter Xu <pet...@redhat.com> -- Peter Xu