diff mbox

[1/3] libxl: switch to using libxl_domain_create_restore from v4.4 API

Message ID 1462237279-6954-2-git-send-email-jfehlig@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jim Fehlig May 3, 2016, 1:01 a.m. UTC
In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
gained a parameter for specifying restore parameters. Switch to
using version 0x040400, which will be useful in a subsequent commit
to specify the Xen migration stream version when restoring.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 configure.ac             | 9 +++++----
 src/libxl/libxl_domain.c | 6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Wei Liu May 3, 2016, 1:19 p.m. UTC | #1
On Mon, May 02, 2016 at 07:01:17PM -0600, Jim Fehlig wrote:
> In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
> gained a parameter for specifying restore parameters. Switch to
> using version 0x040400, which will be useful in a subsequent commit
> to specify the Xen migration stream version when restoring.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  configure.ac             | 9 +++++----
>  src/libxl/libxl_domain.c | 6 +++++-
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 88e2e20..0da0f75 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -875,10 +875,11 @@ if test "$with_libxl" != "no" ; then
>      fi
>  fi
>  
> -# Until there is a need to use enhancements of libxl APIs such as
> -# libxl_domain_create_restore and libxl_set_vcpuaffinity, stick with
> -# the APIs as defined in libxl API version 4.2.0.
> -LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
> +# LIBXL_API_VERSION 4.4.0 introduced a new parameter to
> +# libxl_domain_create_restore for specifying restore parameters.
> +# The libxl driver will make use of this new parameter for specifying
> +# the Xen migration stream version.
> +LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040400"
>  LIBS="$old_LIBS"
>  CFLAGS="$old_CFLAGS"
>  
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 14a900c..32ad946 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -1028,6 +1028,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>      libxlDriverConfigPtr cfg;
>      virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
>      libxl_asyncprogress_how aop_console_how;
> +    libxl_domain_restore_params params;
>  
>      libxl_domain_config_init(&d_config);
>  
> @@ -1115,8 +1116,11 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>          ret = libxl_domain_create_new(cfg->ctx, &d_config,
>                                        &domid, NULL, &aop_console_how);
>      } else {
> +        libxl_domain_restore_params_init(&params);
>          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> -                                          restore_fd, NULL, &aop_console_how);
> +                                          restore_fd, &params, NULL,
> +                                          &aop_console_how);
> +        libxl_domain_restore_params_dispose(&params);
>      }
>      virObjectLock(vm);
>  
> -- 
> 2.1.4
>
Olaf Hering May 11, 2016, 6:01 a.m. UTC | #2
On Mon, May 02, Jim Fehlig wrote:

> In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
> gained a parameter for specifying restore parameters. Switch to
> using version 0x040400, which will be useful in a subsequent commit
> to specify the Xen migration stream version when restoring.

This breaks compilation with xen-4.3 etc. Is this intentional?

Olaf
Jim Fehlig May 12, 2016, 12:04 a.m. UTC | #3
On 05/11/2016 12:01 AM, Olaf Hering wrote:
> On Mon, May 02, Jim Fehlig wrote:
>
>> In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API
>> gained a parameter for specifying restore parameters. Switch to
>> using version 0x040400, which will be useful in a subsequent commit
>> to specify the Xen migration stream version when restoring.
> This breaks compilation with xen-4.3 etc. Is this intentional?

Yes. Did you see my message elsewhere in the thread when I notified I was
pushing the series?

https://www.redhat.com/archives/libvir-list/2016-May/msg00686.html

Regards,
Jim
Olaf Hering May 12, 2016, 7:29 a.m. UTC | #4
On Wed, May 11, Jim Fehlig wrote:

> https://www.redhat.com/archives/libvir-list/2016-May/msg00686.html

Perhaps configure.ac should be changed to reject libxl upfront. It looks
like the assignment of LIBXL_CFLAGS should be moved up, so that
AC_CHECK_LIB gets the -DLIBXL_API_VERSION as well. I will provide a
patch for that.

Olaf
Jim Fehlig May 12, 2016, 3:18 p.m. UTC | #5
Olaf Hering wrote:
> On Wed, May 11, Jim Fehlig wrote:
> 
>> https://www.redhat.com/archives/libvir-list/2016-May/msg00686.html
> 
> Perhaps configure.ac should be changed to reject libxl upfront.

Yes, good idea.

> It looks
> like the assignment of LIBXL_CFLAGS should be moved up, so that
> AC_CHECK_LIB gets the -DLIBXL_API_VERSION as well. I will provide a
> patch for that.

Ok, thanks for volunteering!

Regards,
Jim
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 88e2e20..0da0f75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -875,10 +875,11 @@  if test "$with_libxl" != "no" ; then
     fi
 fi
 
-# Until there is a need to use enhancements of libxl APIs such as
-# libxl_domain_create_restore and libxl_set_vcpuaffinity, stick with
-# the APIs as defined in libxl API version 4.2.0.
-LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
+# LIBXL_API_VERSION 4.4.0 introduced a new parameter to
+# libxl_domain_create_restore for specifying restore parameters.
+# The libxl driver will make use of this new parameter for specifying
+# the Xen migration stream version.
+LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040400"
 LIBS="$old_LIBS"
 CFLAGS="$old_CFLAGS"
 
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 14a900c..32ad946 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1028,6 +1028,7 @@  libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     libxlDriverConfigPtr cfg;
     virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
     libxl_asyncprogress_how aop_console_how;
+    libxl_domain_restore_params params;
 
     libxl_domain_config_init(&d_config);
 
@@ -1115,8 +1116,11 @@  libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
         ret = libxl_domain_create_new(cfg->ctx, &d_config,
                                       &domid, NULL, &aop_console_how);
     } else {
+        libxl_domain_restore_params_init(&params);
         ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
-                                          restore_fd, NULL, &aop_console_how);
+                                          restore_fd, &params, NULL,
+                                          &aop_console_how);
+        libxl_domain_restore_params_dispose(&params);
     }
     virObjectLock(vm);