[libvirt] [PATCH 4/5] libvirt.c: Preserve MigratePerform failure

Daniel P. Berrange berrange at redhat.com
Tue Jan 12 12:29:37 UTC 2010


On Mon, Jan 11, 2010 at 03:34:47PM -0500, Cole Robinson wrote:
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  src/libvirt.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 4308573..b95a8ed 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -3135,6 +3135,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
>      char *dom_xml = NULL;
>      int cookielen = 0, ret;
>      virDomainInfo info;
> +    virErrorPtr origerr = NULL;
>  
>      /* Prepare the migration.
>       *
> @@ -3190,6 +3191,10 @@ virDomainMigrateVersion2 (virDomainPtr domain,
>      ret = domain->conn->driver->domainMigratePerform
>          (domain, cookie, cookielen, uri, flags, dname, bandwidth);
>  
> +    /* Perform failed. Make sure Finish doesn't overwrite the error */
> +    if (ret < 0)
> +        origerr = virSaveLastError();
> +
>      /* In version 2 of the migration protocol, we pass the
>       * status code from the sender to the destination host,
>       * so it can do any cleanup if the migration failed.
> @@ -3199,6 +3204,10 @@ virDomainMigrateVersion2 (virDomainPtr domain,
>          (dconn, dname, cookie, cookielen, uri, flags, ret);
>  
>   done:
> +    if (origerr) {
> +        virSetError(origerr);
> +        virFreeError(origerr);
> +    }
>      VIR_FREE (uri_out);
>      VIR_FREE (cookie);
>      return ddomain;

ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list