On Fri, 9 Jan 2026 at 18:18, Fabiano Rosas <[email protected]> wrote:
> After cleanups, the qmp_migrate_finish function is now just a call to
> migration_connect_outgoing(). Remove qmp_migrate_finish() and rename
> the qmp_migrate_finish_cb callback.
>
> This also allows the function's error handling to be removed as it now
> receives &local_err like the rest of the callees of qmp_migrate().
>
> Reviewed-by: Peter Xu <[email protected]>
> Signed-off-by: Fabiano Rosas <[email protected]>
> ---
>  migration/migration.c | 35 +++++++++++++----------------------
>  1 file changed, 13 insertions(+), 22 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 6be2849326..086bbb03de 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2001,15 +2001,18 @@ static bool migrate_prepare(MigrationState *s, bool 
> resume, Error **errp)
>      return true;
>  }
>
> -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp);
> -
> -static gboolean qmp_migrate_finish_cb(QIOChannel *channel,
> -                                      GIOCondition cond,
> -                                      void *opaque)
> +static gboolean migration_connect_outgoing_cb(QIOChannel *channel,
> +                                              GIOCondition cond, void 
> *opaque)
>  {
> -    MigrationAddress *addr = opaque;
> +    MigrationState *s = migrate_get_current();
> +    Error *local_err = NULL;
> +
> +    migration_connect_outgoing(s, opaque, &local_err);
> +
> +    if (local_err) {
> +        migration_connect_error_propagate(s, local_err);
> +    }
>
> -    qmp_migrate_finish(addr, NULL);
>      return G_SOURCE_REMOVE;
>  }
>
> @@ -2063,10 +2066,11 @@ void qmp_migrate(const char *uri, bool has_channels,
>       * connection, so qmp_migrate_finish will fail to connect, and then 
> recover.
>       */
>      if (migrate_mode() == MIG_MODE_CPR_TRANSFER) {
> -        cpr_transfer_add_hup_watch(s, qmp_migrate_finish_cb, main_ch->addr);
> +        cpr_transfer_add_hup_watch(s, migration_connect_outgoing_cb,
> +                                   main_ch->addr);
>
>      } else {
> -        qmp_migrate_finish(main_ch->addr, errp);
> +        migration_connect_outgoing(s, main_ch->addr, &local_err);
>      }
>
>  out:
> @@ -2076,19 +2080,6 @@ out:
>      }
>  }
>
> -static void qmp_migrate_finish(MigrationAddress *addr, Error **errp)
> -{
> -    MigrationState *s = migrate_get_current();
> -    Error *local_err = NULL;
> -
> -    migration_connect_outgoing(s, addr, &local_err);
> -
> -    if (local_err) {
> -        migration_connect_error_propagate(s, error_copy(local_err));
> -        error_propagate(errp, local_err);
> -    }
> -}
> -
>  void qmp_migrate_cancel(Error **errp)
>  {
>      /*
> --

* Nice. Looks good.
Reviewed-by: Prasad Pandit <[email protected]>

Thank you.
---
  - Prasad


Reply via email to