On Wed, Mar 05, 2025 at 03:48:20PM -0700, Jim Fehlig via Devel wrote:
> Similar to qemuMigrationSrcRun, apply migration parameters in
> qemuMigrationDstRun. This allows callers to create customized
> migration parameters, but delegates their application to the
> function performing the migration.
> 
> Signed-off-by: Jim Fehlig <jfeh...@suse.com>
> ---
>  src/qemu/qemu_migration.c | 16 ++++++++++------
>  src/qemu/qemu_migration.h |  5 ++++-
>  src/qemu/qemu_process.c   |  2 +-
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index f692986056..329b5f61d4 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2427,7 +2427,10 @@ qemuMigrationDstGetURI(const char *migrateFrom,
>  int
>  qemuMigrationDstRun(virDomainObj *vm,
>                      const char *uri,
> -                    virDomainAsyncJob asyncJob)
> +                    virDomainAsyncJob asyncJob,
> +                    qemuMigrationParams *migParams,
> +                    unsigned int flags)
> +
>  {
>      virTristateBool exitOnError = VIR_TRISTATE_BOOL_ABSENT;
>      qemuDomainObjPrivate *priv = vm->privateData;
> @@ -2435,6 +2438,10 @@ qemuMigrationDstRun(virDomainObj *vm,
>  
>      VIR_DEBUG("Setting up incoming migration with URI %s", uri);
>  
> +    if (migParams && qemuMigrationParamsApply(vm, asyncJob,
> +                                              migParams, flags) < 0)
> +        return -1;
> +
>      /* Ask QEMU not to exit on failure during incoming migration (if 
> supported)
>       * so that we can properly check and report error during Finish phase.
>       */
> @@ -3368,10 +3375,6 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
>              goto error;
>      }
>  
> -    if (qemuMigrationParamsApply(vm, VIR_ASYNC_JOB_MIGRATION_IN,
> -                                 migParams, flags) < 0)
> -        goto error;
> -

So semantically, we now apply the dst migration parameters /after/
starting the NBD server, instead of before. This seems like it
ought to be safe, as migration is independent of the NBD block layer.

>      if (mig->nbd &&
>          flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC)) {
>          const char *nbdTLSAlias = NULL;
> @@ -3403,7 +3406,8 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
>      }
>  
>      if (qemuMigrationDstRun(vm, incoming->uri,
> -                            VIR_ASYNC_JOB_MIGRATION_IN) < 0)
> +                            VIR_ASYNC_JOB_MIGRATION_IN,
> +                            migParams, flags) < 0)
>          goto error;
>  
>      if (qemuProcessFinishStartup(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN,

Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Reply via email to