[libvirt] [PATCH 3/6] Introduce yet another migration version in API.

Eric Blake eblake at redhat.com
Wed Feb 9 21:19:13 UTC 2011


On 02/09/2011 09:58 AM, Daniel P. Berrange wrote:
> This patch attempts to introduce a version 3 that uses the
> improved 5 step sequence
> 
>  *  Src: Begin
>           - Generate XML to pass to dst
>           - Generate optional cookie to pass to dst
> 
>  *  Dst: Prepare
>           - Get ready to accept incoming VM
>           - Generate optional cookie to pass to src
> 
>  *  Src: Perform
>           - Start migration and wait for send completion
>           - Generate optional cookie to pass to dst
> 
>  *  Dst: Finish
>           - Wait for recv completion and check status
>           - Kill off VM if failed, resume if success
>           - Generate optional cookie to pass to src
> 
>  *  Src: Confirm
>           - Kill off VM if success, resume if failed
> 
> The API is designed to allow both input and output cookies
> in all methods where applicable. This lets us pass around
> arbitrary extra driver specific data between src & dst during
> migration. Combined with the extra 'Begin' method this lets
> us pass lease information from source to dst at the start of
> migration

This sounds like a post-0.8.8 change, but a good one.

> +static virDomainPtr
> +virDomainMigrateVersion3(virDomainPtr domain,
> +                         virConnectPtr dconn,
> +                         unsigned long flags,
> +                         const char *dname,
> +                         const char *uri,
> +                         unsigned long bandwidth)
> +{
> +
> +    if (uri == NULL && uri_out == NULL) {
> +        virLibConnError(VIR_ERR_INTERNAL_ERROR,
> +                        _("domainMigratePrepare2 did not set uri"));

s/2/3/

> +        virDispatchError(domain->conn);
> +        goto done;
> +    }
> +    if (uri_out)
> +        uri = uri_out; /* Did domainMigratePrepare2 change URI? */

s/2/3/

> +    /*
> +     * The status code from the source is passed to the destination.
> +     * The dest can cleanup in the source indicated it failed to

s/in/if/


> +    if (conn->driver->domainMigrateBegin3) {
> +        char *xml;
> +        xml = conn->driver->domainMigrateBegin3(domain,
> +                                                cookieout, cookieoutlen,
> +                                                flags, dname, bandwidth);
> +        VIR_DEBUG("xml %s", xml);

s/ xml/ NULLSTR(xml)/

> +int virDomainMigrateFinish3(virConnectPtr dconn,
> +                            const char *dname,
> +                            const char *cookiein,
> +                            int cookieinlen,
> +                            char **cookieout,
> +                            int *cookieoutlen,
> +                            const char *uri,
> +                            unsigned long flags,
> +                            int cancelled, /* Kill the dst VM */
> +                            virDomainPtr *newdom);
> +
> +int virDomainMigrateConfirm3(virDomainPtr domain,
> +                             const char *cookiein,
> +                             int cookieinlen,
> +                             unsigned long flags,
> +                             int restart); /* Restart the src VM */

Since cancelled and restart are basically bool, should they be
incorporated into flags rather than an extra argument?  But I'm fine
with leaving them separate, especially since that leaves flags for just
those bits requested by the user.

ACK with those nits fixed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110209/a68fe905/attachment-0001.sig>


More information about the libvir-list mailing list