[libvirt] [PATCH 0/2] improve driver module building

This comment: https://www.redhat.com/archives/libvir-list/2011-March/msg00899.html
No change to src/libvirt_private.syms to list all these new functions? Nothing required this (yet)
made me double check behavior of ./autogen.sh --with-driver-modules, and sure enough, things were broken. Patch 1 fixes the breakage, and patch 2 tries to improve automation to make it easier to prevent (or detect sooner) in the future. Eric Blake (2): build: fix driver module build build: let autobuild check module build autobuild.sh | 10 ++++++++++ src/Makefile.am | 9 +++++++-- src/libvirt_private.syms | 20 ++++++++++++++++++++ src/libvirt_xenxs.syms | 22 ++++++++++++++++++++++ tests/Makefile.am | 30 +++++++++++++++++------------- 5 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 src/libvirt_xenxs.syms -- 1.7.4

* src/libvirt_xenxs.syms: New file. * src/Makefile.am (USED_SYM_FILES, EXTRA_DIST): Add new file. * src/libvirt_private.syms (domain_conf.h): Add missing exports. * tests/Makefile.am (xml2sexprtest_LDADD, sexpr2xmltest_LDADD) (xmconfigtest_LDADD, xencapstest_LDADD): Add missing library. (LDADDS): Globally include libvirt_util.la as needed. Don't include WARN_CFLAGS; INCLUDES already does that. --- Ever since the creation of the xenxs directory, anything trying to use a dynamic xen driver was broken due to missing exports. src/Makefile.am | 9 +++++++-- src/libvirt_private.syms | 20 ++++++++++++++++++++ src/libvirt_xenxs.syms | 22 ++++++++++++++++++++++ tests/Makefile.am | 30 +++++++++++++++++------------- 4 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 src/libvirt_xenxs.syms diff --git a/src/Makefile.am b/src/Makefile.am index c3729a6..990e910 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1115,6 +1115,10 @@ if WITH_VMX USED_SYM_FILES += libvirt_vmx.syms endif +if WITH_XEN +USED_SYM_FILES += libvirt_xenxs.syms +endif + EXTRA_DIST += \ libvirt_public.syms \ libvirt_private.syms \ @@ -1123,8 +1127,9 @@ EXTRA_DIST += \ libvirt_linux.syms \ libvirt_macvtap.syms \ libvirt_daemon.syms \ - libvirt_nwfilter.syms \ - libvirt_vmx.syms + libvirt_nwfilter.syms \ + libvirt_vmx.syms \ + libvirt_xenxs.syms BUILT_SOURCES += libvirt.syms libvirt.def libvirt_qemu.def diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 55be36e..1158b0f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -311,6 +311,8 @@ virDomainSoundModelTypeFromString; virDomainSoundModelTypeToString; virDomainStateTypeFromString; virDomainStateTypeToString; +virDomainSysinfoTypeFromString; +virDomainSysinfoTypeToString; virDomainTimerModeTypeFromString; virDomainTimerModeTypeToString; virDomainTimerNameTypeFromString; @@ -757,6 +759,24 @@ virSecurityManagerSetSocketLabel; virSecurityManagerVerify; +# sexpr.h +sexpr2string; +sexpr_append; +sexpr_cons; +sexpr_float; +sexpr_fmt_node; +sexpr_free; +sexpr_has; +sexpr_int; +sexpr_lookup; +sexpr_nil; +sexpr_node; +sexpr_node_copy; +sexpr_string; +sexpr_u64; +string2sexpr; + + # storage_conf.h virStoragePartedFsTypeTypeToString; virStoragePoolDefFormat; diff --git a/src/libvirt_xenxs.syms b/src/libvirt_xenxs.syms new file mode 100644 index 0000000..2f7caf4 --- /dev/null +++ b/src/libvirt_xenxs.syms @@ -0,0 +1,22 @@ +# +# These symbols are currently dependent upon WITH_XEN (configure --with-xen), +# and will soon also impact WITH_LIBXL (--with-libxl). +# + +# xen_sxpr.h +xenFormatSxpr; +xenFormatSxprChr; +xenFormatSxprDisk; +xenFormatSxprNet; +xenFormatSxprOnePCI; +xenFormatSxprSound; +xenGetDomIdFromSxpr; +xenGetDomIdFromSxprString; +xenParseSxpr; +xenParseSxprChar; +xenParseSxprSound; +xenParseSxprString; + +# xen_xm.h +xenFormatXM; +xenParseXM; diff --git a/tests/Makefile.am b/tests/Makefile.am index 5896442..89d879c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,8 +14,8 @@ INCLUDES = \ $(SASL_CFLAGS) \ $(SELINUX_CFLAGS) \ $(APPARMOR_CFLAGS) \ - $(COVERAGE_CFLAGS) \ - $(WARN_CFLAGS) + $(COVERAGE_CFLAGS) \ + $(WARN_CFLAGS) if WITH_DRIVER_MODULES INCLUDES += \ @@ -25,15 +25,15 @@ endif LDADDS = \ $(STATIC_BINARIES) \ $(LIBXML_LIBS) \ - $(GNUTLS_LIBS) \ - $(SASL_LIBS) \ - $(SELINUX_LIBS) \ - $(APPARMOR_LIBS) \ - $(WARN_CFLAGS) \ + $(GNUTLS_LIBS) \ + $(SASL_LIBS) \ + $(SELINUX_LIBS) \ + $(APPARMOR_LIBS) \ ../src/libvirt_test.la \ + ../src/libvirt_util.la \ ../gnulib/lib/libgnu.la \ $(LIBSOCKET) \ - $(COVERAGE_LDFLAGS) + $(COVERAGE_LDFLAGS) EXTRA_DIST = \ capabilityschemadata \ @@ -222,27 +222,31 @@ valgrind: sockettest_SOURCES = \ sockettest.c \ testutils.c testutils.h -sockettest_LDADD = ../src/libvirt_util.la $(LDADDS) +sockettest_LDADD = $(LDADDS) if WITH_XEN xml2sexprtest_SOURCES = \ xml2sexprtest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xml2sexprtest_LDADD = ../src/libvirt_xenxs.la \ + ../src/libvirt_driver_xen.la $(LDADDS) sexpr2xmltest_SOURCES = \ sexpr2xmltest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +sexpr2xmltest_LDADD = ../src/libvirt_xenxs.la \ + ../src/libvirt_driver_xen.la $(LDADDS) xmconfigtest_SOURCES = \ xmconfigtest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -xmconfigtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xmconfigtest_LDADD = ../src/libvirt_xenxs.la \ + ../src/libvirt_driver_xen.la $(LDADDS) xencapstest_SOURCES = \ xencapstest.c testutils.h testutils.c -xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xencapstest_LDADD = ../src/libvirt_xenxs.la \ + ../src/libvirt_driver_xen.la $(LDADDS) reconnect_SOURCES = \ reconnect.c -- 1.7.4

Many times, we don't notice a bug in src/libvirt_private.syms until someone attempts a build with modules enabled. Having autobuild.sh stress that can only help. * autobuild.sh: Add test of --with-driver-modules. Update mingw build to skip recent driver additions. --- autobuild.sh | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 54fb273..cbccfa9 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -61,6 +61,14 @@ if [ -f /usr/bin/rpmbuild ]; then -ba --clean libvirt.spec fi +# Test build with modules +make distclean +../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ + --with-driver-modules \ + --enable-compile-warnings=error +make check + +# Test mingw cross-compile if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then make distclean @@ -83,6 +91,8 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then --without-openvz \ --without-one \ --without-phyp \ + --without-xenapi \ + --without-libxl \ --without-netcf \ --without-audit \ --without-dtrace \ -- 1.7.4

On Tue, Mar 22, 2011 at 03:45:20PM -0600, Eric Blake wrote:
Many times, we don't notice a bug in src/libvirt_private.syms until someone attempts a build with modules enabled. Having autobuild.sh stress that can only help.
* autobuild.sh: Add test of --with-driver-modules. Update mingw build to skip recent driver additions. --- autobuild.sh | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/autobuild.sh b/autobuild.sh index 54fb273..cbccfa9 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -61,6 +61,14 @@ if [ -f /usr/bin/rpmbuild ]; then -ba --clean libvirt.spec fi
+# Test build with modules +make distclean +../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ + --with-driver-modules \ + --enable-compile-warnings=error +make check +
This won't really check very much. What we really want is to create a simple test case, that links to the main libvirt.so (ie not the test_libvirt.so which omits symbol versions), and then does a dlopen() on each module we built & reports error if any fail. I'd also be inclined to just add '--with-driver-modules' to the existing autogen.sh line in autobuild.sh, rather than doing yet another clean+build cycle.
@@ -83,6 +91,8 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then --without-openvz \ --without-one \ --without-phyp \ + --without-xenapi \ + --without-libxl \ --without-netcf \ --without-audit \ --without-dtrace \
Actually, we shouldn't need these here. Ideally we'd get to the point where we don't need *any* of these --without-XXX options in autobuild.sh. It should be automatically figuring out what is available itself. Only in the RPM builds should we have use --with and --without flags to strictly control what is built. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake