[libvirt] [PATCH v3] nwfilter: fix loadable module support

Matthias Bolte matthias.bolte at googlemail.com
Tue Jun 22 10:48:37 UTC 2010


2010/6/22 Daniel P. Berrange <berrange at redhat.com>:
> On Mon, Jun 21, 2010 at 02:27:36PM -0400, Stefan Berger wrote:
>> On 06/21/2010 11:33 AM, Daniel P. Berrange wrote:
>> >On Wed, Jun 16, 2010 at 11:33:48AM -0400, Stefan Berger wrote:
>> >
>> >>Following Daniel Berrange's multiple helpful suggestions for improving
>> >>this patch and introducing another driver interface, I now wrote the
>> >>below patch where the nwfilter driver registers the functions to
>> >>instantiate and teardown the nwfilters with a function in
>> >>conf/domain_nwfilter.c called virDomainConfNWFilterRegister. Previous
>> >>helper functions that were called from qemu_driver.c and qemu_conf.c
>> >>were move into conf/domain_nwfilter.h with slight renaming done for
>> >>consistency. Those functions now call the function expored by
>> >>domain_nwfilter.c, which in turn call the functions of the new driver
>> >>interface, if available.
>> >>
>> >>V3: no more inline functions
>> >>
>> >>Signed-off-by: Stefan Berger<stefanb at us.ibm.com>
>> >>
>> >>---
>> >>  src/Makefile.am                        |    3 +
>> >>  src/conf/domain_nwfilter.c             |   61
>> >>+++++++++++++++++++++++++++++++++
>> >>  src/conf/domain_nwfilter.h             |   43 +++++++++++++++++++++++
>> >>  src/libvirt_private.syms               |    5 ++
>> >>  src/nwfilter/nwfilter_driver.c         |   23 ++++++++++++
>> >>  src/nwfilter/nwfilter_gentech_driver.h |   17 ---------
>> >>  src/qemu/qemu_conf.c                   |   17 ++++-----
>> >>  src/qemu/qemu_driver.c                 |   10 ++---
>> >>  8 files changed, 148 insertions(+), 31 deletions(-)
>> >>
>> >ACK, this looks good now
>> >
>>
>> Thanks. Pushed it now.
>>
>> The only patch that I need now to compile with --with-driver-modules
>> (using --without-xen) is this here:
>>
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 5109302..e553f35 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -1001,7 +1001,7 @@ libvirt_la_LDFLAGS =
>> $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMB
>>                     $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS)
>>  libvirt_la_BUILT_LIBADD += ../gnulib/lib/libgnu.la
>>  libvirt_la_LIBADD += $(LIBXML_LIBS) \
>> -                   $(LIBPCAP_LIBS) $(LIBNL_LIBS) \
>> +                   $(LIBPCAP_LIBS) $(LIBNL_LIBS) $(GNUTLS_LIBS) \
>>                     $(DRIVER_MODULE_LIBS) \
>>                     $(CYGWIN_EXTRA_LIBADD)
>>  libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
>
> I think that one needs to be against libvirt_driver_la_CFLAGS instead.
> since that's where the source file using gnutls is.
>
> Regards,
> Daniel
>

I think the problem Stefan tries to fix here is this one while linking
virsh. The calls to gcry_check_version and gcry_control are in
libvirt.c itself.

  CCLD   virsh
../src/.libs/libvirt.so: undefined reference to `gcry_check_version'
../src/.libs/libvirt.so: undefined reference to `gcry_control'

Therefore, this patch adds GnuTLS to libvirt_la_{LIBADD|CFLAGS}. It
also adds a missing dependency for the statstest.


diff --git a/src/Makefile.am b/src/Makefile.am
index 5109302..eb93727 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1001,10 +1002,10 @@ libvirt_la_LDFLAGS =
$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE) \
                    $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS)
 libvirt_la_BUILT_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_la_LIBADD += $(LIBXML_LIBS) \
-                   $(LIBPCAP_LIBS) $(LIBNL_LIBS) \
+                   $(LIBPCAP_LIBS) $(LIBNL_LIBS) $(GNUTLS_LIBS) \
                    $(DRIVER_MODULE_LIBS) \
                    $(CYGWIN_EXTRA_LIBADD)
-libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) -DIN_LIBVIRT
+libvirt_la_CFLAGS = $(COVERAGE_CFLAGS) $(GNUTLS_CFLAGS) -DIN_LIBVIRT
 # Because we specify libvirt_la_DEPENDENCIES for $(LIBVIRT_SYMBOL_FILE), we
 # lose automake's automatic dependencies on an appropriate subset of
 # $(libvirt_la_LIBADD).  But we were careful to create
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3661f6..574d0cf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -329,7 +329,7 @@ nodeinfotest_LDADD = $(LDADDS)

 statstest_SOURCES = \
        statstest.c testutils.h testutils.c
-statstest_LDADD = $(LDADDS)
+statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS)

 if WITH_SECDRIVER_SELINUX
 seclabeltest_SOURCES = \


This fixes compilation, but there are still runtime errors about
undefined symbols. I'll post a patch for this soon.

Matthias




More information about the libvir-list mailing list