[libvirt PATCH 62/80] qemu: Simplify cleanup in qemuMigrationDstPrepareFresh

Peter Krempa pkrempa at redhat.com
Thu May 12 14:49:04 UTC 2022


On Tue, May 10, 2022 at 17:21:23 +0200, Jiri Denemark wrote:
> Since most of the cleanup code was moved out of this function, we don't
> need to preserve the original error here.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

[...]

> @@ -3480,7 +3479,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
>      ret = 0;
>  
>   cleanup:
> -    virErrorPreserveLast(&origErr);
>      if (ret < 0 && priv) {
>          /* priv is set right after vm is added to the list of domains
>           * and there is no 'goto cleanup;' in the middle of those */
> @@ -3489,8 +3487,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
>          qemuDomainRemoveInactive(driver, vm);

I'm not sure how much we care, but qemuDomainRemoveInactive has
theoretical possibility to overwrite the error in at least the
snapshot/checkpoint removal code and also via qemuExtDevicesCleanupHost.

>      }
>      virDomainObjEndAPI(&vm);
> -    qemuMigrationCookieFree(mig);
> -    virErrorRestore(&origErr);
>      return ret;

If you add justification to the commit message outlining why it's okay
not to preserve the error or drop that part:

Reviewed-by: Peter Krempa <pkrempa at redhat.com>


More information about the libvir-list mailing list