On Fri, Dec 26, 2025 at 06:19:09PM -0300, Fabiano Rosas wrote:
> cpr_set_incoming_mode() is only called on the target side, so
> migrate_mode() on the source side is the same as s->parameters.mode.
> 
> Use the function to reduce explicit access to s->parameters, we have
> options.c for that.
> 
> Signed-off-by: Fabiano Rosas <[email protected]>

Reviewed-by: Peter Xu <[email protected]>

Said that, we have three more users outside options.c.  Wanna do it
together?  They are:

  migration_call_notifiers, migrate_mode_is_cpr, migrate_prepare.

> ---
>  migration/migration.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index f2933f7789..4b1afcab24 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2252,7 +2252,7 @@ void qmp_migrate(const char *uri, bool has_channels,
>          return;
>      }
>  
> -    if (s->parameters.mode == MIG_MODE_CPR_TRANSFER && !cpr_channel) {
> +    if (migrate_mode() == MIG_MODE_CPR_TRANSFER && !cpr_channel) {
>          error_setg(errp, "missing 'cpr' migration channel");
>          return;
>      }
> @@ -2277,7 +2277,7 @@ void qmp_migrate(const char *uri, bool has_channels,
>       * in which case the target will not listen for the incoming migration
>       * connection, so qmp_migrate_finish will fail to connect, and then 
> recover.
>       */
> -    if (s->parameters.mode == MIG_MODE_CPR_TRANSFER) {
> +    if (migrate_mode() == MIG_MODE_CPR_TRANSFER) {
>          migrate_hup_add(s, cpr_state_ioc(), 
> (GSourceFunc)qmp_migrate_finish_cb,
>                          QAPI_CLONE(MigrationAddress, addr));
>  
> -- 
> 2.51.0
> 

-- 
Peter Xu


Reply via email to