Re: [libvirt PATCH 55/80] qmeu: Refactor qemuMigrationSrcPerformPhase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 10, 2022 at 17:21:16 +0200, Jiri Denemark wrote:
> To make the code flow a bit more sensible.
> 
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
>  src/qemu/qemu_migration.c | 26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 99b1d4b88b..dd18a4ad63 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -5819,29 +5819,27 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
>      }
>  
>      if (qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3) < 0)
> -        goto endjob;
> +        goto cleanup;
>  
>      virCloseCallbacksUnset(driver->closeCallbacks, vm,
>                             qemuMigrationSrcCleanup);
>  
> -    ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
> -                                        cookieout, cookieoutlen,
> -                                        flags, resource, NULL, graphicsuri,
> -                                        nmigrate_disks, migrate_disks, migParams, nbdURI);
> -
> -    if (ret < 0) {
> -        qemuMigrationSrcRestoreDomainState(driver, vm);
> -        goto endjob;
> -    }
> -
> -    ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
> +    if (qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
> +                                      cookieout, cookieoutlen,
> +                                      flags, resource, NULL, graphicsuri,
> +                                      nmigrate_disks, migrate_disks, migParams, nbdURI) < 0)
> +        goto cleanup;
>  
>      if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
>                               qemuMigrationSrcCleanup) < 0)
> -        goto endjob;
> +        goto cleanup;

So this failure now becomes an error from previously being technically
ignored, and ...

>  
> - endjob:
> +    ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
> +    ret = 0;
> +
> + cleanup:
>      if (ret < 0 && !virDomainObjIsFailedPostcopy(vm)) {
> +        qemuMigrationSrcRestoreDomainState(driver, vm);

... this call will not be skipped in such case, thus restoring the VM,
but since we fail anyways the migration will be cancelled.

So I think this can be considered a "bugfix" for a extremely
unlikely/impossible bug.

>          qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
>                                   jobPriv->migParams, priv->job.apiFlags);
>          qemuMigrationJobFinish(vm);
> -- 
> 2.35.1
> 

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux