[libvirt] [PATCH] xen: Fix build when with xen disabled and libxl enabled

Jim Fehlig jfehlig at suse.com
Thu Dec 1 02:10:42 UTC 2016


On 11/30/2016 12:39 PM, Peter Krempa wrote:
> xen_common.c does not get compiled in such case which breaks the build
> due to xenDomainDefAddImplicitInputDevice not being available.

Odd that I don't see this problem on current git master. I've configured libvirt 
with '--without-xen --with-libxl'.

BTW, xen_common.c is needed by the libxl driver. It handles parsing/formatting 
config that is common between xm.config(5) and xl.cfg(5).

Regards,
Jim

> Move the function to a different place to resolve the issue. Caused by
> commit 36785c7e
> ---
>  src/Makefile.am            |  4 ++--
>  src/conf/domain_conf.c     | 22 ++++++++++++++++++++++
>  src/conf/domain_conf.h     |  3 +++
>  src/libxl/libxl_domain.c   |  3 +--
>  src/xen/xen_driver.c       |  2 +-
>  src/xenapi/xenapi_driver.c |  3 +--
>  src/xenconfig/xen_common.c | 22 ----------------------
>  src/xenconfig/xen_common.h |  3 ---
>  8 files changed, 30 insertions(+), 32 deletions(-)
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index d440548..eaf7b59 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1250,7 +1250,7 @@ libvirt_driver_xen_impl_la_CFLAGS =				\
>  		-I$(srcdir)/xenconfig				\
>  		$(AM_CFLAGS)
>  libvirt_driver_xen_impl_la_LDFLAGS = $(AM_LDFLAGS)
> -libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS) libvirt_xenconfig.la
> +libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS)
>  libvirt_driver_xen_impl_la_SOURCES = $(XEN_DRIVER_SOURCES)
>  endif WITH_XEN
>
> @@ -1311,7 +1311,7 @@ if WITH_XENAPI
>  noinst_LTLIBRARIES += libvirt_driver_xenapi.la
>  libvirt_la_BUILT_LIBADD += libvirt_driver_xenapi.la
>  libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(CURL_CFLAGS) \
> -		-I$(srcdir)/conf -I$(srcdir)/xenconfig $(AM_CFLAGS)
> +		-I$(srcdir)/conf $(AM_CFLAGS)
>  libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS)
>  libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(CURL_LIBS)
>  libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index b001efc..64665fa 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -25786,3 +25786,25 @@ virDomainDefVcpuOrderClear(virDomainDefPtr def)
>      for (i = 0; i < def->maxvcpus; i++)
>          def->vcpus[i]->order = 0;
>  }
> +
> +
> +int
> +virDomainDefXenAddImplicitInputDevice(virDomainDefPtr def)
> +{
> +    virDomainInputBus implicitInputBus = VIR_DOMAIN_INPUT_BUS_XEN;
> +
> +    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
> +        implicitInputBus = VIR_DOMAIN_INPUT_BUS_PS2;
> +
> +    if (virDomainDefMaybeAddInput(def,
> +                                  VIR_DOMAIN_INPUT_TYPE_MOUSE,
> +                                  implicitInputBus) < 0)
> +        return -1;
> +
> +    if (virDomainDefMaybeAddInput(def,
> +                                  VIR_DOMAIN_INPUT_TYPE_KBD,
> +                                  implicitInputBus) < 0)
> +        return -1;
> +
> +    return 0;
> +}
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 4447b03..00e833d 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -3211,4 +3211,7 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
>                                           virTypedParameterPtr params,
>                                           int *nparams,
>                                           int maxparams);
> +
> +int virDomainDefXenAddImplicitInputDevice(virDomainDefPtr def);
> +
>  #endif /* __DOMAIN_CONF_H */
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 5cde576..557a408 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -37,7 +37,6 @@
>  #include "virstring.h"
>  #include "virtime.h"
>  #include "locking/domain_lock.h"
> -#include "xen_common.h"
>  #include "network/bridge_driver.h"
>
>  #define VIR_FROM_THIS VIR_FROM_LIBXL
> @@ -407,7 +406,7 @@ libxlDomainDefPostParse(virDomainDefPtr def,
>      }
>
>      /* add implicit input devices */
> -    if (xenDomainDefAddImplicitInputDevice(def) < 0)
> +    if (virDomainDefXenAddImplicitInputDevice(def) < 0)
>          return -1;
>
>      return 0;
> diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> index 3f9bfa7..55c3eb4 100644
> --- a/src/xen/xen_driver.c
> +++ b/src/xen/xen_driver.c
> @@ -384,7 +384,7 @@ xenDomainDefPostParse(virDomainDefPtr def,
>      }
>
>      /* add implicit input device */
> -    if (xenDomainDefAddImplicitInputDevice(def) <0)
> +    if (virDomainDefXenAddImplicitInputDevice(def) <0)
>          return -1;
>
>      return 0;
> diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
> index a9ed407..0949192 100644
> --- a/src/xenapi/xenapi_driver.c
> +++ b/src/xenapi/xenapi_driver.c
> @@ -39,7 +39,6 @@
>  #include "xenapi_driver_private.h"
>  #include "xenapi_utils.h"
>  #include "virstring.h"
> -#include "xen_common.h"
>
>  #define VIR_FROM_THIS VIR_FROM_XENAPI
>
> @@ -80,7 +79,7 @@ xenapiDomainDefPostParse(virDomainDefPtr def,
>                           void *parseOpaque ATTRIBUTE_UNUSED)
>  {
>      /* add implicit input device */
> -    if (xenDomainDefAddImplicitInputDevice(def) < 0)
> +    if (virDomainDefXenAddImplicitInputDevice(def) < 0)
>          return -1;
>
>      return 0;
> diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> index 7968d40..b129f5e 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -1870,25 +1870,3 @@ xenFormatConfigCommon(virConfPtr conf,
>
>      return 0;
>  }
> -
> -
> -int
> -xenDomainDefAddImplicitInputDevice(virDomainDefPtr def)
> -{
> -    virDomainInputBus implicitInputBus = VIR_DOMAIN_INPUT_BUS_XEN;
> -
> -    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
> -        implicitInputBus = VIR_DOMAIN_INPUT_BUS_PS2;
> -
> -    if (virDomainDefMaybeAddInput(def,
> -                                  VIR_DOMAIN_INPUT_TYPE_MOUSE,
> -                                  implicitInputBus) < 0)
> -        return -1;
> -
> -    if (virDomainDefMaybeAddInput(def,
> -                                  VIR_DOMAIN_INPUT_TYPE_KBD,
> -                                  implicitInputBus) < 0)
> -        return -1;
> -
> -    return 0;
> -}
> diff --git a/src/xenconfig/xen_common.h b/src/xenconfig/xen_common.h
> index 9055692..de981ba 100644
> --- a/src/xenconfig/xen_common.h
> +++ b/src/xenconfig/xen_common.h
> @@ -67,7 +67,4 @@ int xenFormatConfigCommon(virConfPtr conf,
>                            virConnectPtr conn,
>                            const char *nativeFormat);
>
> -
> -int xenDomainDefAddImplicitInputDevice(virDomainDefPtr def);
> -
>  #endif /* __VIR_XEN_COMMON_H__ */
>




More information about the libvir-list mailing list