[libvirt] [RFC PATCH] build: isolate core libvirt libs deps from xen runtime

Wim Ten Have posted 1 patch 6 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20171005160029.19165-1-wim.ten.have@oracle.com
src/Makefile.am              | 17 +++++++++++++----
src/libvirt_xenxlconfig.syms |  2 --
2 files changed, 13 insertions(+), 6 deletions(-)
[libvirt] [RFC PATCH] build: isolate core libvirt libs deps from xen runtime
Posted by Wim Ten Have 6 years, 6 months ago
From: Wim ten Have <wim.ten.have@oracle.com>

Generating libvirt packages per make rpm, "with_libxl=1" and "with_xen=1",
adds strict runtime dependencies per libxenlight for xen-libs package from
core libvirt-libs package.  This is not necessary and unfortunate since
those dependencies set demand to "xen-libs" package even when there's no
need for libvirt xen or libxl driver components.

This patch is to have two separate xenconfig lib tool libraries: one for
core libvirt (without XL), and a another that contains xl for libxl driver
(libvirt_driver_libxl_impl.la) which when loading the driver, loads the
remaining symbols (xen{Format,Parse}XL. For the user/sysadmin, this means
the xen dependencies are moved into libxl driver, instead of core libvirt.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
---
 src/Makefile.am              | 17 +++++++++++++----
 src/libvirt_xenxlconfig.syms |  2 --
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 173fba1e6..80fa2feba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1197,7 +1197,8 @@ XENCONFIG_SOURCES =						\
 		xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h	\
 		xenconfig/xen_xm.c xenconfig/xen_xm.h
 if WITH_LIBXL
-XENCONFIG_SOURCES +=						\
+XENCONFIG_LIBXL_SOURCES =							\
+		$(XENCONFIG_SOURCES)						\
 		xenconfig/xen_xl.c xenconfig/xen_xl.h
 endif WITH_LIBXL
 
@@ -1258,10 +1259,17 @@ endif WITH_VMX
 if WITH_XENCONFIG
 noinst_LTLIBRARIES += libvirt_xenconfig.la
 libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
-libvirt_xenconfig_la_LIBADD = $(LIBXL_LIBS)
 libvirt_xenconfig_la_CFLAGS = \
-		-I$(srcdir)/conf -I$(srcdir)/libxl $(AM_CFLAGS)
+		-I$(srcdir)/conf $(AM_CFLAGS)
 libvirt_xenconfig_la_SOURCES = $(XENCONFIG_SOURCES)
+
+if WITH_LIBXL
+noinst_LTLIBRARIES += libvirt_xenconfig_libxl.la
+libvirt_xenconfig_libxl_la_LIBADD = $(LIBXL_LIBS)
+libvirt_xenconfig_libxl_la_CFLAGS = \
+		-I$(srcdir)/conf -I$(srcdir)/libxl $(AM_CFLAGS)
+libvirt_xenconfig_libxl_la_SOURCES = $(XENCONFIG_LIBXL_SOURCES)
+endif WITH_LIBXL
 endif WITH_XENCONFIG
 
 
@@ -1417,7 +1425,7 @@ libvirt_driver_libxl_impl_la_CFLAGS = 		\
 		$(AM_CFLAGS)
 libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS)
 libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) \
-				      libvirt_xenconfig.la \
+				      libvirt_xenconfig_libxl.la \
 				      libvirt_secret.la
 libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
 
@@ -2045,6 +2053,7 @@ EXTRA_DIST +=							\
 		$(VBOX_DRIVER_EXTRA_DIST)			\
 		$(VMWARE_DRIVER_SOURCES)			\
 		$(XENCONFIG_SOURCES)				\
+		$(XENCONFIG_LIBXL_SOURCES)			\
 		$(ACCESS_DRIVER_POLKIT_POLICY)
 
 check-local: check-augeas
diff --git a/src/libvirt_xenxlconfig.syms b/src/libvirt_xenxlconfig.syms
index dbe43aac7..50407002d 100644
--- a/src/libvirt_xenxlconfig.syms
+++ b/src/libvirt_xenxlconfig.syms
@@ -3,8 +3,6 @@
 #
 
 #xenconfig/xen_xl.h
-xenFormatXL;
-xenParseXL;
 
 # Let emacs know we want case-insensitive sorting
 # Local Variables:
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH] build: isolate core libvirt libs deps from xen runtime
Posted by Jim Fehlig 6 years, 6 months ago
On 10/05/2017 10:00 AM, Wim Ten Have wrote:
> From: Wim ten Have <wim.ten.have@oracle.com>
> 
> Generating libvirt packages per make rpm, "with_libxl=1" and "with_xen=1",
> adds strict runtime dependencies per libxenlight for xen-libs package from
> core libvirt-libs package.  This is not necessary and unfortunate since
> those dependencies set demand to "xen-libs" package even when there's no
> need for libvirt xen or libxl driver components.

This can also be seen in the local build artifacts, e.g.

$libvirtsrc> ldd src/.libs/libvirt.so | grep xen
   libxenlight.so.4.9 => /usr/lib64/libxenlight.so.4.9 (0x00007f896ec3e000)
   libxentoollog.so.1 => /usr/lib64/libxentoollog.so.1 (0x00007f896e827000)
   libxenevtchn.so.1 => /usr/lib64/libxenevtchn.so.1 (0x00007f896c144000)
   libxenctrl.so.4.9 => /usr/lib64/libxenctrl.so.4.9 (0x00007f896bf16000)
   libxenguest.so.4.9 => /usr/lib64/libxenguest.so.4.9 (0x00007f896bce8000)
   libxenstore.so.3.0 => /usr/lib64/libxenstore.so.3.0 (0x00007f896badd000)
   ...

> This patch is to have two separate xenconfig lib tool libraries: one for
> core libvirt (without XL), and a another that contains xl for libxl driver
> (libvirt_driver_libxl_impl.la) which when loading the driver, loads the
> remaining symbols (xen{Format,Parse}XL. For the user/sysadmin, this means
> the xen dependencies are moved into libxl driver, instead of core libvirt.

I think this is a good short-term fix given the code structure. During my sparse 
free cycles I've been working on a series to remove the legacy xen driver. 
Perhaps as part of that work (or a follow-up) I should move the files in 
src/xenconfig to src/libxl since the libxl driver will be the only user of 
src/xenconfig once the legacy xen driver is removed.

> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
> ---
>   src/Makefile.am              | 17 +++++++++++++----
>   src/libvirt_xenxlconfig.syms |  2 --
>   2 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 173fba1e6..80fa2feba 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -1197,7 +1197,8 @@ XENCONFIG_SOURCES =						\
>   		xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h	\
>   		xenconfig/xen_xm.c xenconfig/xen_xm.h
>   if WITH_LIBXL
> -XENCONFIG_SOURCES +=						\
> +XENCONFIG_LIBXL_SOURCES =							\
> +		$(XENCONFIG_SOURCES)						\

This breaks the column alignment with all the preceeding '\'.

>   		xenconfig/xen_xl.c xenconfig/xen_xl.h
>   endif WITH_LIBXL
>   
> @@ -1258,10 +1259,17 @@ endif WITH_VMX
>   if WITH_XENCONFIG
>   noinst_LTLIBRARIES += libvirt_xenconfig.la
>   libvirt_la_BUILT_LIBADD += libvirt_xenconfig.la
> -libvirt_xenconfig_la_LIBADD = $(LIBXL_LIBS)
>   libvirt_xenconfig_la_CFLAGS = \
> -		-I$(srcdir)/conf -I$(srcdir)/libxl $(AM_CFLAGS)
> +		-I$(srcdir)/conf $(AM_CFLAGS)
>   libvirt_xenconfig_la_SOURCES = $(XENCONFIG_SOURCES)
> +
> +if WITH_LIBXL
> +noinst_LTLIBRARIES += libvirt_xenconfig_libxl.la
> +libvirt_xenconfig_libxl_la_LIBADD = $(LIBXL_LIBS)
> +libvirt_xenconfig_libxl_la_CFLAGS = \
> +		-I$(srcdir)/conf -I$(srcdir)/libxl $(AM_CFLAGS)
> +libvirt_xenconfig_libxl_la_SOURCES = $(XENCONFIG_LIBXL_SOURCES)
> +endif WITH_LIBXL
>   endif WITH_XENCONFIG
>   
>   
> @@ -1417,7 +1425,7 @@ libvirt_driver_libxl_impl_la_CFLAGS = 		\
>   		$(AM_CFLAGS)
>   libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS)
>   libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) \
> -				      libvirt_xenconfig.la \
> +				      libvirt_xenconfig_libxl.la \
>   				      libvirt_secret.la
>   libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
>   
> @@ -2045,6 +2053,7 @@ EXTRA_DIST +=							\
>   		$(VBOX_DRIVER_EXTRA_DIST)			\
>   		$(VMWARE_DRIVER_SOURCES)			\
>   		$(XENCONFIG_SOURCES)				\
> +		$(XENCONFIG_LIBXL_SOURCES)			\
>   		$(ACCESS_DRIVER_POLKIT_POLICY)
>   
>   check-local: check-augeas
> diff --git a/src/libvirt_xenxlconfig.syms b/src/libvirt_xenxlconfig.syms
> index dbe43aac7..50407002d 100644
> --- a/src/libvirt_xenxlconfig.syms
> +++ b/src/libvirt_xenxlconfig.syms
> @@ -3,8 +3,6 @@
>   #
>   
>   #xenconfig/xen_xl.h
> -xenFormatXL;
> -xenParseXL;

There's nothing left in this file after removing these :-). I think the file can 
be removed, along with its inclusion in {USED_,}SYM_FILES in src/Makefile.am.

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list