diff mbox

[V2] libxl: use LIBXL_API_VERSION 0x040200

Message ID 1460673312-4454-1-git-send-email-jfehlig@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jim Fehlig April 14, 2016, 10:35 p.m. UTC
To ensure the libvirt libxl driver will build with future versions
of Xen where the libxl API may change in incompatible ways,
explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
does use new libxl APIs that have been added since Xen 4.2, but
currently it does not make use of any changes made to existing
APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
The version can be bumped if/when the libxl driver consumes the
changed APIs.

Further details can be found in the following discussion thread

https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 configure.ac             |  2 ++
 src/libxl/libxl_conf.h   | 12 ------------
 src/libxl/libxl_domain.c | 15 ---------------
 3 files changed, 2 insertions(+), 27 deletions(-)

Comments

Dario Faggioli April 15, 2016, 8:47 a.m. UTC | #1
On Thu, 2016-04-14 at 16:35 -0600, Jim Fehlig wrote:
> To ensure the libvirt libxl driver will build with future versions
> of Xen where the libxl API may change in incompatible ways,
> explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
> does use new libxl APIs that have been added since Xen 4.2, but
> currently it does not make use of any changes made to existing
> APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
> The version can be bumped if/when the libxl driver consumes the
> changed APIs.
> 
> Further details can be found in the following discussion thread
> 
> https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>

Thanks and Regards,
Dario
Martin Kletzander April 15, 2016, 9:48 a.m. UTC | #2
On Thu, Apr 14, 2016 at 04:35:12PM -0600, Jim Fehlig wrote:
>To ensure the libvirt libxl driver will build with future versions
>of Xen where the libxl API may change in incompatible ways,
>explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
>does use new libxl APIs that have been added since Xen 4.2, but
>currently it does not make use of any changes made to existing
>APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
>The version can be bumped if/when the libxl driver consumes the
>changed APIs.
>
>Further details can be found in the following discussion thread
>
>https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
>Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>---
> configure.ac             |  2 ++
> src/libxl/libxl_conf.h   | 12 ------------
> src/libxl/libxl_domain.c | 15 ---------------
> 3 files changed, 2 insertions(+), 27 deletions(-)
>
>diff --git a/configure.ac b/configure.ac
>index b1500f6..446f2a2 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -894,6 +894,7 @@ if test "$with_libxl" != "no" ; then
>     PKG_CHECK_MODULES([LIBXL], [xenlight], [
>      LIBXL_FIRMWARE_DIR=`$PKG_CONFIG --variable xenfirmwaredir xenlight`
>      LIBXL_EXECBIN_DIR=`$PKG_CONFIG --variable libexec_bin xenlight`
>+     LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
>      with_libxl=yes
>     ], [LIBXL_FOUND=no])
>     if test "$LIBXL_FOUND" = "no"; then
>@@ -906,6 +907,7 @@ if test "$with_libxl" != "no" ; then
>         LIBS="$LIBS $LIBXL_LIBS"
>         AC_CHECK_LIB([xenlight], [libxl_ctx_alloc], [
>             with_libxl=yes
>+            LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
>             LIBXL_LIBS="$LIBXL_LIBS -lxenlight"
>         ],[
>             if test "$with_libxl" = "yes"; then


Looks good, I'd just adjust these two hunks so that it's added in one
place (and can be changed in one place later on so we don't fall into
trouble accidentally.  ACK with that changed.

Martin
Jim Fehlig April 15, 2016, 6:42 p.m. UTC | #3
On 04/15/2016 03:48 AM, Martin Kletzander wrote:
> On Thu, Apr 14, 2016 at 04:35:12PM -0600, Jim Fehlig wrote:
>> To ensure the libvirt libxl driver will build with future versions
>> of Xen where the libxl API may change in incompatible ways,
>> explicitly use LIBXL_API_VERSION 0x040200. The libxl driver
>> does use new libxl APIs that have been added since Xen 4.2, but
>> currently it does not make use of any changes made to existing
>> APIs such as libxl_domain_create_restore or libxl_set_vcpuaffinity.
>> The version can be bumped if/when the libxl driver consumes the
>> changed APIs.
>>
>> Further details can be found in the following discussion thread
>>
>> https://www.redhat.com/archives/libvir-list/2016-April/msg00178.html
>> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
>> ---
>> configure.ac             |  2 ++
>> src/libxl/libxl_conf.h   | 12 ------------
>> src/libxl/libxl_domain.c | 15 ---------------
>> 3 files changed, 2 insertions(+), 27 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index b1500f6..446f2a2 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -894,6 +894,7 @@ if test "$with_libxl" != "no" ; then
>>     PKG_CHECK_MODULES([LIBXL], [xenlight], [
>>      LIBXL_FIRMWARE_DIR=`$PKG_CONFIG --variable xenfirmwaredir xenlight`
>>      LIBXL_EXECBIN_DIR=`$PKG_CONFIG --variable libexec_bin xenlight`
>> +     LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
>>      with_libxl=yes
>>     ], [LIBXL_FOUND=no])
>>     if test "$LIBXL_FOUND" = "no"; then
>> @@ -906,6 +907,7 @@ if test "$with_libxl" != "no" ; then
>>         LIBS="$LIBS $LIBXL_LIBS"
>>         AC_CHECK_LIB([xenlight], [libxl_ctx_alloc], [
>>             with_libxl=yes
>> +            LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
>>             LIBXL_LIBS="$LIBXL_LIBS -lxenlight"
>>         ],[
>>             if test "$with_libxl" = "yes"; then
>
>
> Looks good, I'd just adjust these two hunks so that it's added in one
> place (and can be changed in one place later on so we don't fall into
> trouble accidentally.  ACK with that changed.

Thanks. I used one LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
after the test for libxenlight, and added a comment for good measure. Pushed now.

Regards,
Jim
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index b1500f6..446f2a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -894,6 +894,7 @@  if test "$with_libxl" != "no" ; then
     PKG_CHECK_MODULES([LIBXL], [xenlight], [
      LIBXL_FIRMWARE_DIR=`$PKG_CONFIG --variable xenfirmwaredir xenlight`
      LIBXL_EXECBIN_DIR=`$PKG_CONFIG --variable libexec_bin xenlight`
+     LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
      with_libxl=yes
     ], [LIBXL_FOUND=no])
     if test "$LIBXL_FOUND" = "no"; then
@@ -906,6 +907,7 @@  if test "$with_libxl" != "no" ; then
         LIBS="$LIBS $LIBXL_LIBS"
         AC_CHECK_LIB([xenlight], [libxl_ctx_alloc], [
             with_libxl=yes
+            LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200"
             LIBXL_LIBS="$LIBXL_LIBS -lxenlight"
         ],[
             if test "$with_libxl" = "yes"; then
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 3c0eafb..24e2911 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -69,18 +69,6 @@ 
 # endif
 
 
-/* libxl interface for setting VCPU affinity changed in 4.5. In fact, a new
- * parameter has been added, representative of 'VCPU soft affinity'. If one
- * does not care about it (and that's libvirt case), passing NULL is the
- * right thing to do. To mark that change, LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
- * is defined. */
-# ifdef LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
-#  define libxl_set_vcpuaffinity(ctx, domid, vcpuid, map) \
-    libxl_set_vcpuaffinity((ctx), (domid), (vcpuid), (map), NULL)
-#  define libxl_set_vcpuaffinity_all(ctx, domid, max_vcpus, map) \
-    libxl_set_vcpuaffinity_all((ctx), (domid), (max_vcpus), (map), NULL)
-# endif
-
 typedef struct _libxlDriverPrivate libxlDriverPrivate;
 typedef libxlDriverPrivate *libxlDriverPrivatePtr;
 
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 86fb713..14a900c 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1026,9 +1026,6 @@  libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     int managed_save_fd = -1;
     libxlDomainObjPrivatePtr priv = vm->privateData;
     libxlDriverConfigPtr cfg;
-#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
-    libxl_domain_restore_params params;
-#endif
     virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
     libxl_asyncprogress_how aop_console_how;
 
@@ -1118,20 +1115,8 @@  libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
         ret = libxl_domain_create_new(cfg->ctx, &d_config,
                                       &domid, NULL, &aop_console_how);
     } else {
-#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
-        params.checkpointed_stream = 0;
-        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
-                                          restore_fd, -1, &params, NULL,
-                                          &aop_console_how);
-#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
-        params.checkpointed_stream = 0;
-        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
-                                          restore_fd, &params, NULL,
-                                          &aop_console_how);
-#else
         ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
                                           restore_fd, NULL, &aop_console_how);
-#endif
     }
     virObjectLock(vm);