On Thu, Apr 14, 2016 at 12:37 AM, Jim Fehlig <jfehlig(a)suse.com>
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(a)suse.com>
> ---
> src/Makefile.am | 1 +
> src/libxl/libxl_conf.h | 12 ------------
> src/libxl/libxl_domain.c | 15 ---------------
> 3 files changed, 1 insertion(+), 27 deletions(-)
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 08ff301..259a474 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1311,6 +1311,7 @@ endif ! WITH_DRIVER_MODULES
>
> libvirt_driver_libxl_impl_la_CFLAGS = \
> $(LIBXL_CFLAGS) \
> + -DLIBXL_API_VERSION=0x040200 \
> -I$(srcdir)/access \
> -I$(srcdir)/conf \
> -I$(srcdir)/secret \
> 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
Just checking with this -- the LIBXL_API_VERSION is meant for
*forward* compatibility, but I think the LIBXL_HAVE_* macros are for
*backwards* compatibility, isn't that right? If you compile this
against an older version of Xen without LIBXL_HAVE_VCPU_SOFT_AFFINITY
(say, 4.4), will it break with this patch?
I've tested the patch (well, actually a variant that moves
'-DLIBXL_API_VERSION=0x040200' to configure.ac as suggested by Martin) by
building against 4.2, 4.3, 4.4, and 4.7/master. I think Dario already did a good
job explaining the removal of the above hunk.
Regards,
Jim