[libvirt] [PATCH 2/9] Add a second URI parameter to virDomainMigratePerform3 method

Matthias Bolte matthias.bolte at googlemail.com
Wed May 25 07:44:48 UTC 2011


2011/5/24 Daniel P. Berrange <berrange at redhat.com>:
> The virDomainMigratePerform3 currently has a single URI parameter
> whose meaning varies. It is either
>
>  - A QEMU migration URI (normal migration)
>  - A libvirtd connection URI (peer2peer migration)
>
> Unfortunately when using peer2peer migration, without also
> using tunnelled migration, it is possible that both URIs are
> required.
>
> This adds a second URI parameter to the virDomainMigratePerform3
> method, to cope with this scenario. Each parameter how has a fixed
> meaning.
>
> NB, there is no way to actually take advantage of this yet,
> since virDomainMigrate/virDomainMigrateToURI do not have any
> way to provide the 2 separate URIs
>
> * daemon/remote.c, src/remote/remote_driver.c,
>  src/remote/remote_protocol.x, src/remote_protocol-structs: Add
>  the second URI parameter to perform3 message
> * src/driver.h, src/libvirt.c, src/libvirt_internal.h: Add
>  the second URI parameter to Perform3 method
> * src/libvirt_internal.h, src/qemu/qemu_migration.c,
>  src/qemu/qemu_migration.h: Update to handle URIs correctly
> ---
>  daemon/remote.c              |   13 +++++++++++--
>  src/driver.h                 |    2 ++
>  src/libvirt.c                |   37 +++++++++++++++++++++++++------------
>  src/libvirt_internal.h       |    6 ++++--
>  src/qemu/qemu_driver.c       |   12 ++++++++++--
>  src/qemu/qemu_migration.c    |   26 +++++++++++++++++---------
>  src/qemu/qemu_migration.h    |    1 +
>  src/remote/remote_driver.c   |    8 ++++++--
>  src/remote/remote_protocol.x |    6 ++++--
>  src/remote_protocol-structs  |    1 +
>  10 files changed, 81 insertions(+), 31 deletions(-)
>

> diff --git a/src/libvirt.c b/src/libvirt.c
> index 7b7323e..2b2c1fd 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c

> @@ -4766,10 +4778,10 @@ virDomainMigratePerform3(virDomainPtr domain,
>     virConnectPtr conn;
>
>     VIR_DOMAIN_DEBUG(domain, "xmlin=%s cookiein=%p, cookieinlen=%d, "
> -                     "cookieout=%p, cookieoutlen=%p, "
> +                     "cookieout=%p, cookieoutlen=%p, dconnuri=%s, "
>                      "uri=%s, flags=%lu, dname=%s, bandwidth=%lu",
>                      NULLSTR(xmlin), cookiein, cookieinlen,
> -                     cookieout, cookieoutlen,
> +                     cookieout, cookieoutlen, NULLSTR(dconnuri),
>                      uri, flags, NULLSTR(dname), bandwidth);

uri can be NULL here, can't it? So this should use NULLSTR(uri)
instead of plain uri.

> @@ -4817,15 +4829,16 @@ virDomainMigrateFinish3(virConnectPtr dconn,
>                         int cookieinlen,
>                         char **cookieout,
>                         int *cookieoutlen,
> +                        const char *dconnuri,
>                         const char *uri,
>                         unsigned long flags,
>                         int cancelled,
>                         virDomainPtr *newdom)
>  {
>     VIR_DEBUG("dconn=%p, dname=%s, cookiein=%p, cookieinlen=%d, cookieout=%p,"
> -              "cookieoutlen=%p, uri=%s, flags=%lu, retcode=%d newdom=%p",
> +              "cookieoutlen=%p, dconnuri=%s, uri=%s, flags=%lu, retcode=%d newdom=%p",
>               dconn, NULLSTR(dname), cookiein, cookieinlen, cookieout,
> -              cookieoutlen, uri, flags, cancelled, newdom);
> +              cookieoutlen, NULLSTR(dconnuri), NULLSTR(uri), flags, cancelled, newdom);
>
>     virResetLastError();

Here it's correct.

> diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
> index c7c1932..3144271 100644
> --- a/src/libvirt_internal.h
> +++ b/src/libvirt_internal.h
> @@ -161,7 +161,8 @@ int virDomainMigratePerform3(virDomainPtr dom,
>                              int cookieinlen,
>                              char **cookieout,
>                              int *cookieoutlen,
> -                             const char *uri,
> +                             const char *dconnuri, /* libvirtd URI if Peer2Peer, NULL otherwise */
> +                             const char *uri, /* VM Migration URI */
>                              unsigned long flags,
>                              const char *dname,
>                              unsigned long resource);
> @@ -172,7 +173,8 @@ int virDomainMigrateFinish3(virConnectPtr dconn,
>                             int cookieinlen,
>                             char **cookieout,
>                             int *cookieoutlen,
> -                            const char *uri,
> +                            const char *dconnuri, /* libvirtd URI if Peer2Peer, NULL otherwise */
> +                            const char *uri, /* VM Migration URI */
>                             unsigned long flags,
>                             int cancelled, /* Kill the dst VM */
>                             virDomainPtr *newdom);

Maybe state in this comments that uri is NULL in the Peer2Peer case,
just for clarity.

> diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
> index 971f53a..014e5ac 100644
> --- a/src/remote_protocol-structs
> +++ b/src/remote_protocol-structs
> @@ -1510,6 +1510,7 @@ struct remote_domain_migrate_perform3_args {
>                 u_int              cookie_in_len;
>                 char *             cookie_in_val;
>         } cookie_in;
> +        remote_string              dconnuri;
>         remote_nonnull_string      uri;
>         uint64_t                   flags;
>         remote_string              dname;

As uri is now optional you need to change its type from
remote_nonnull_string to remote_string here and in
remote_domain_migrate_finish3_args. And you need to add remote_string
dconnuri to remote_domain_migrate_finish3_args to satisfy make
syntax-check.

ACK, with this nits fixed.

Matthias




More information about the libvir-list mailing list