* Dr. David Alan Gilbert (dgilb...@redhat.com) wrote:
> Hi,
>   Is there any way that we could make it easier to add new migration
> parameters? The current way is complicated and error prone;
> as far as I can tell, to add a new parameter we need to:
> 
>   1) qapi-schema.json
>     a) Add to 'MigrationParameter' enum, include comment
>     b) Add to migrate-set-parameters
>     c) Add to MigrationParameters
>   2) Define the 'default' macro at the top of migration.c
>   3) Add the initialisation to migrate_get_current to set the default
>   4) qmp_migrate_set_parameters:
>     a) Add the 'has' and value arguments to qmp_migrate_set_parameters
>        *** Make really sure this matches the order in migrate-set-parameters!
>     b) Add a bounds check on the value
>     c) Set the value in the array if the has_ is true
>   5) Fixup migrate_init to preserve the parameter around the init
>   6) Add a bool and case entry to hmp_migrate_set_parameter and
>     pass to qmp_migrate_set_parameters
>        *** Make sure you get the order to qmp_migrate_set_parameters right
>   7) Fixup hmp_info_migrate_parameters

oh, and don't forget to:
  8) add the entries to qmp_query_migrate_parameters

(I forgot).

Dave
> 
> 
> The three separate changes needed in the qapi-schema.json seem odd,
> and the 'has'/value pairs on qmp_migrate_set_parameters is just a nightmare
> because there's nothing to check the ordering, and it's just getting
> a silly number of arguments to the function now (I've got 10
> parameters in one of my dev worlds, so that function has 21 arguments).
> 
> In my ideal world there would be:
>    a) One thing to add to qapi-schema.json
>    b) qmp_migrate_set_parameters would take an array pointer indexed
>       by the enum
>    c) A way to define the bounds so that we didn't have to manually
>       add the bound checking.
>    d) Something where I defined the default value
> 
> (I'm fairly sure earlier versions of migrate parameters patches
> managed (a) and possibly (b)).
> 
> Dave
> --
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to