[libvirt] [PATCH 00/10 v2] Enable loadable modules for libvirtd

A simple rebase of https://www.redhat.com/archives/libvir-list/2012-April/msg00045.html For a long timer we've had the ability to build each libvirt driver as a loadable module. We have never used this by default and as a result it constantly bit-rots. This series fixes various bugs, and then enables it by default in configure. It also makes the PRMs use the loadable modules, adding new new sub-RPMs for each module. We can now finally install minimal libvirt binaries for each hypervisor. ie yum install libvirt-daemon-kvm will not pull in Xen libraries! Changes in v2: - Fix build with dtrace - Rebase to latest GIT master configure.ac | 20 ++ daemon/Makefile.am | 5 daemon/libvirtd.c | 35 ++++ libvirt.spec.in | 298 +++++++++++++++++++++++++++++++++++++++- src/Makefile.am | 156 ++++++-------------- src/driver.c | 20 ++ src/driver.h | 1 src/internal.h | 2 src/libvirt.c | 129 +++++------------ src/libvirt_driver_modules.syms | 1 src/libvirt_esx.syms | 7 src/libvirt_openvz.syms | 7 src/libvirt_private.syms | 41 +++++ src/libvirt_probes.d | 21 -- src/libvirt_qemu_probes.d | 21 ++ src/qemu/qemu_monitor.c | 4 src/qemu/qemu_monitor_json.c | 4 src/qemu/qemu_monitor_text.c | 4 tests/Makefile.am | 91 ++++++------ tests/virdrivermoduletest.c | 104 +++++++++++++ 20 files changed, 705 insertions(+), 266 deletions(-)

From: "Daniel P. Berrange" <berrange@redhat.com> The driver modules all use symbols which are defined in libvirt.so. Thus for loading of modules to work, the binary that libvirt.so is linked to must be exported its symbols back to modules. If the libvirt.so itself is dlopen()d then the RTLD_GLOBAL flag must be set. Unfortunately few, if any, programming languages use the RTLD_GLOBAL flag when loading modules :-( This means is it not practical to use driver modules for any libvirt client side drivers (OpenVZ, VMWare, Hyper-V, Remote client, test). This patch changes the build process so only server side drivers are built as modules (Xen, QEMU, LXC, UML) * daemon/libvirtd.c: Add missing load of 'interface' driver * src/Makefile.am: Only build server side drivers as modules * src/libvirt.c: Don't load any driver modules Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/libvirtd.c | 29 +++++++++++- src/Makefile.am | 75 ++----------------------------- src/libvirt.c | 129 ++++++++++++++++++----------------------------------- 3 files changed, 74 insertions(+), 159 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 0b5ae35..1e91a45 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -363,14 +363,39 @@ static void daemonInitialize(void) * If they try to open a connection for a module that * is not loaded they'll get a suitable error at that point */ +# ifdef WITH_NETWORK virDriverLoadModule("network"); +# endif +# ifdef WITH_STORAGE virDriverLoadModule("storage"); +# endif +# ifdef WITH_NODE_DEVICES virDriverLoadModule("nodedev"); +# endif +# ifdef WITH_SECRETS virDriverLoadModule("secret"); +# endif +# ifdef WITH_NWFILTER + virDriverLoadModule("nwfilter"); +# endif +# ifdef WITH_INTERFACE + virDriverLoadModule("interface"); +# endif +# ifdef WITH_QEMU virDriverLoadModule("qemu"); +# endif +# ifdef WITH_LXC virDriverLoadModule("lxc"); +# endif +# ifdef WITH_UML virDriverLoadModule("uml"); - virDriverLoadModule("nwfilter"); +# endif +# ifdef WITH_XEN + virDriverLoadModule("xen"); +# endif +# ifdef WITH_LIBXL + virDriverLoadModule("libxl"); +# endif #else # ifdef WITH_NETWORK networkRegister(); @@ -381,7 +406,7 @@ static void daemonInitialize(void) # ifdef WITH_STORAGE_DIR storageRegister(); # endif -# if defined(WITH_NODE_DEVICES) +# ifdef WITH_NODE_DEVICES nodedevRegister(); # endif # ifdef WITH_SECRETS diff --git a/src/Makefile.am b/src/Makefile.am index e9621c1..8ad6644 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -626,27 +626,16 @@ libvirt_driver_la_LIBADD = $(NUMACTL_LIBS) $(GNUTLS_LIBS) $(DLOPEN_LIBS) USED_SYM_FILES = libvirt_private.syms if WITH_TEST -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_test.la -else noinst_LTLIBRARIES += libvirt_driver_test.la libvirt_la_BUILT_LIBADD += libvirt_driver_test.la -endif libvirt_driver_test_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) -if WITH_DRIVER_MODULES -libvirt_driver_test_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -endif libvirt_driver_test_la_SOURCES = $(TEST_DRIVER_SOURCES) endif if WITH_REMOTE -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_remote.la -else noinst_LTLIBRARIES += libvirt_driver_remote.la libvirt_la_BUILT_LIBADD += libvirt_driver_remote.la -endif libvirt_driver_remote_la_CFLAGS = \ $(GNUTLS_CFLAGS) \ $(XDR_CFLAGS) \ @@ -658,10 +647,6 @@ libvirt_driver_remote_la_LIBADD = $(GNUTLS_LIBS) \ libvirt-net-rpc-client.la \ libvirt-net-rpc-server.la \ libvirt-net-rpc.la -if WITH_DRIVER_MODULES -libvirt_driver_remote_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_remote_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_remote_la_SOURCES = $(REMOTE_DRIVER_SOURCES) $(srcdir)/remote/remote_driver.c: $(REMOTE_DRIVER_GENERATED) @@ -681,7 +666,8 @@ if WITH_DRIVER_MODULES mod_LTLIBRARIES += libvirt_driver_xen.la else noinst_LTLIBRARIES += libvirt_driver_xen.la -libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la +# Stateful, so linked to daemon instead +#libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la endif libvirt_driver_xen_la_CFLAGS = \ $(XEN_CFLAGS) \ @@ -698,86 +684,48 @@ libvirt_driver_xen_la_SOURCES = $(XEN_DRIVER_SOURCES) endif if WITH_PHYP -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_phyp.la -else noinst_LTLIBRARIES += libvirt_driver_phyp.la libvirt_la_BUILT_LIBADD += libvirt_driver_phyp.la -endif libvirt_driver_phyp_la_LIBADD = $(LIBSSH2_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_phyp_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_phyp_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -endif libvirt_driver_phyp_la_CFLAGS = $(LIBSSH2_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_phyp_la_SOURCES = $(PHYP_DRIVER_SOURCES) endif if WITH_OPENVZ -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_openvz.la -else noinst_LTLIBRARIES += libvirt_driver_openvz.la libvirt_la_BUILT_LIBADD += libvirt_driver_openvz.la -endif libvirt_driver_openvz_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) -if WITH_DRIVER_MODULES -libvirt_driver_openvz_la_LIBADD = ../gnulib/lib/libgnu.la -libvirt_driver_openvz_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -endif libvirt_driver_openvz_la_SOURCES = $(OPENVZ_DRIVER_SOURCES) endif if WITH_VMWARE -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_vmware.la -else noinst_LTLIBRARIES += libvirt_driver_vmware.la libvirt_la_BUILT_LIBADD += libvirt_driver_vmware.la -endif libvirt_driver_vmware_la_CFLAGS = \ -I$(top_srcdir)/src/conf -I$(top_srcdir)/src/vmx $(AM_CFLAGS) -if WITH_DRIVER_MODULES -libvirt_driver_vmware_la_LIBADD = ../gnulib/lib/libgnu.la -libvirt_driver_vmware_la_LDFLAGS = -module -avoid-version -endif libvirt_driver_vmware_la_SOURCES = $(VMWARE_DRIVER_SOURCES) endif if WITH_VBOX -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_vbox.la -else noinst_LTLIBRARIES += libvirt_driver_vbox.la libvirt_la_BUILT_LIBADD += libvirt_driver_vbox.la -endif libvirt_driver_vbox_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS) $(MSCOM_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -endif libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES) endif if WITH_XENAPI -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_xenapi.la -else noinst_LTLIBRARIES += libvirt_driver_xenapi.la libvirt_la_BUILT_LIBADD += libvirt_driver_xenapi.la -endif libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES libvirt_driver_xenapi_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES) endif @@ -896,20 +844,12 @@ $(ESX_DRIVER_GENERATED): $(srcdir)/esx/esx_vi_generator.input \ $(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(srcdir)/esx/esx_vi_generator.py if WITH_ESX -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_esx.la -else noinst_LTLIBRARIES += libvirt_driver_esx.la libvirt_la_BUILT_LIBADD += libvirt_driver_esx.la -endif libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf -I$(top_srcdir)/src/vmx $(AM_CFLAGS) libvirt_driver_esx_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_esx_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_esx_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES) libvirt_driver_esx_la_DEPENDENCIES = $(ESX_DRIVER_GENERATED) endif @@ -922,20 +862,12 @@ $(HYPERV_DRIVER_GENERATED): $(srcdir)/hyperv/hyperv_wmi_generator.input \ $(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(srcdir)/hyperv/hyperv_wmi_generator.py if WITH_HYPERV -if WITH_DRIVER_MODULES -mod_LTLIBRARIES += libvirt_driver_hyperv.la -else noinst_LTLIBRARIES += libvirt_driver_hyperv.la libvirt_la_BUILT_LIBADD += libvirt_driver_hyperv.la -endif libvirt_driver_hyperv_la_CFLAGS = $(OPENWSMAN_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_hyperv_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_hyperv_la_LIBADD = $(OPENWSMAN_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_hyperv_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_hyperv_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES) endif @@ -966,7 +898,8 @@ if WITH_DRIVER_MODULES mod_LTLIBRARIES += libvirt_driver_interface.la else noinst_LTLIBRARIES += libvirt_driver_interface.la -libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la +# Stateful, so linked to daemon instead +#libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la endif libvirt_driver_interface_la_CFLAGS = $(NETCF_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) diff --git a/src/libvirt.c b/src/libvirt.c index 22fc863..8900011 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -45,37 +45,32 @@ #include "virrandom.h" #include "viruri.h" -#ifndef WITH_DRIVER_MODULES -# ifdef WITH_TEST -# include "test/test_driver.h" -# endif -# ifdef WITH_XEN -# include "xen/xen_driver.h" -# endif -# ifdef WITH_REMOTE -# include "remote/remote_driver.h" -# endif -# ifdef WITH_OPENVZ -# include "openvz/openvz_driver.h" -# endif -# ifdef WITH_VMWARE -# include "vmware/vmware_driver.h" -# endif -# ifdef WITH_PHYP -# include "phyp/phyp_driver.h" -# endif -# ifdef WITH_VBOX -# include "vbox/vbox_driver.h" -# endif -# ifdef WITH_ESX -# include "esx/esx_driver.h" -# endif -# ifdef WITH_HYPERV -# include "hyperv/hyperv_driver.h" -# endif -# ifdef WITH_XENAPI -# include "xenapi/xenapi_driver.h" -# endif +#ifdef WITH_TEST +# include "test/test_driver.h" +#endif +#ifdef WITH_REMOTE +# include "remote/remote_driver.h" +#endif +#ifdef WITH_OPENVZ +# include "openvz/openvz_driver.h" +#endif +#ifdef WITH_VMWARE +# include "vmware/vmware_driver.h" +#endif +#ifdef WITH_PHYP +# include "phyp/phyp_driver.h" +#endif +#ifdef WITH_VBOX +# include "vbox/vbox_driver.h" +#endif +#ifdef WITH_ESX +# include "esx/esx_driver.h" +#endif +#ifdef WITH_HYPERV +# include "hyperv/hyperv_driver.h" +#endif +#ifdef WITH_XENAPI +# include "xenapi/xenapi_driver.h" #endif #define VIR_FROM_THIS VIR_FROM_NONE @@ -424,70 +419,32 @@ virInitialize(void) * Note that the order is important: the first ones have a higher * priority when calling virConnectOpen. */ -#ifdef WITH_DRIVER_MODULES - /* We don't care if any of these fail, because the whole point - * is to allow users to only install modules they want to use. - * If they try to open a connection for a module that - * is not loaded they'll get a suitable error at that point - */ -# ifdef WITH_TEST - virDriverLoadModule("test"); -# endif -# ifdef WITH_XEN - virDriverLoadModule("xen"); -# endif -# ifdef WITH_OPENVZ - virDriverLoadModule("openvz"); -# endif -# ifdef WITH_VMWARE - virDriverLoadModule("vmware"); -# endif -# ifdef WITH_VBOX - virDriverLoadModule("vbox"); -# endif -# ifdef WITH_ESX - virDriverLoadModule("esx"); -# endif -# ifdef WITH_HYPERV - virDriverLoadModule("hyperv"); -# endif -# ifdef WITH_XENAPI - virDriverLoadModule("xenapi"); -# endif -# ifdef WITH_REMOTE - virDriverLoadModule("remote"); -# endif -#else -# ifdef WITH_TEST +#ifdef WITH_TEST if (testRegister() == -1) return -1; -# endif -# ifdef WITH_XEN - if (xenRegister () == -1) return -1; -# endif -# ifdef WITH_OPENVZ +#endif +#ifdef WITH_OPENVZ if (openvzRegister() == -1) return -1; -# endif -# ifdef WITH_VMWARE +#endif +#ifdef WITH_VMWARE if (vmwareRegister() == -1) return -1; -# endif -# ifdef WITH_PHYP +#endif +#ifdef WITH_PHYP if (phypRegister() == -1) return -1; -# endif -# ifdef WITH_VBOX +#endif +#ifdef WITH_VBOX if (vboxRegister() == -1) return -1; -# endif -# ifdef WITH_ESX +#endif +#ifdef WITH_ESX if (esxRegister() == -1) return -1; -# endif -# ifdef WITH_HYPERV +#endif +#ifdef WITH_HYPERV if (hypervRegister() == -1) return -1; -# endif -# ifdef WITH_XENAPI +#endif +#ifdef WITH_XENAPI if (xenapiRegister() == -1) return -1; -# endif -# ifdef WITH_REMOTE +#endif +#ifdef WITH_REMOTE if (remoteRegister () == -1) return -1; -# endif #endif return 0; -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The driver modules all use symbols which are defined in libvirt.so. Thus for loading of modules to work, the binary that libvirt.so is linked to must be exported its symbols back to modules. If the
s/must be exported/must export/
libvirt.so itself is dlopen()d then the RTLD_GLOBAL flag must be set. Unfortunately few, if any, programming languages use the RTLD_GLOBAL flag when loading modules :-( This means is it not practical to use driver modules for any libvirt client side drivers (OpenVZ, VMWare, Hyper-V, Remote client, test).
This patch changes the build process so only server side drivers are built as modules (Xen, QEMU, LXC, UML)
* daemon/libvirtd.c: Add missing load of 'interface' driver * src/Makefile.am: Only build server side drivers as modules * src/libvirt.c: Don't load any driver modules
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/libvirtd.c | 29 +++++++++++- src/Makefile.am | 75 ++----------------------------- src/libvirt.c | 129 ++++++++++++++++++----------------------------------- 3 files changed, 74 insertions(+), 159 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, May 21, 2012 at 08:59:09PM +0100, Daniel P. Berrange wrote:
diff --git a/src/Makefile.am b/src/Makefile.am index e9621c1..8ad6644 100644 --- a/src/Makefile.am +++ b/src/Makefile.am
libvirt_driver_xenapi_la_CFLAGS = $(LIBXENSERVER_CFLAGS) $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_xenapi_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_xenapi_la_LIBADD = $(LIBXENSERVER_LIBS) $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES libvirt_driver_xenapi_la_LIBADD += ../gnulib/lib/libgnu.la libvirt_driver_xenapi_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES) endif
This is the cause of the XenAPI build failure noted in patch 3. Those 2 lines inside the if WITH_DRIVER_MODULES should have also been deleted as they were for other entries, eg:
libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf -I$(top_srcdir)/src/vmx $(AM_CFLAGS) libvirt_driver_esx_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_esx_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_esx_la_LDFLAGS += -module -avoid-version -endif libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES) libvirt_driver_esx_la_DEPENDENCIES = $(ESX_DRIVER_GENERATED) endif
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 :|

On 05/23/2012 09:32 AM, Daniel P. Berrange wrote:
On Mon, May 21, 2012 at 08:59:09PM +0100, Daniel P. Berrange wrote:
This is the cause of the XenAPI build failure noted in patch 3. Those 2 lines inside the if WITH_DRIVER_MODULES should have also been deleted as they were for other entries, eg:
libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf -I$(top_srcdir)/src/vmx $(AM_CFLAGS) libvirt_driver_esx_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_esx_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_esx_la_LDFLAGS += -module -avoid-version -endif
Yep, I confirmed that with this tweak, the rest of the series worked for me with an in-tree build (again, see patch 7 for my concerns that we're still a bit too hard-coded for unusual VPATH setups). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/23/2012 04:57 PM, Eric Blake wrote:
On 05/23/2012 09:32 AM, Daniel P. Berrange wrote:
On Mon, May 21, 2012 at 08:59:09PM +0100, Daniel P. Berrange wrote:
This is the cause of the XenAPI build failure noted in patch 3. Those 2 lines inside the if WITH_DRIVER_MODULES should have also been deleted as they were for other entries, eg:
libvirt_driver_esx_la_CFLAGS = $(LIBCURL_CFLAGS) \ -I$(top_srcdir)/src/conf -I$(top_srcdir)/src/vmx $(AM_CFLAGS) libvirt_driver_esx_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_esx_la_LIBADD = $(LIBCURL_LIBS) -if WITH_DRIVER_MODULES -libvirt_driver_esx_la_LIBADD += ../gnulib/lib/libgnu.la -libvirt_driver_esx_la_LDFLAGS += -module -avoid-version -endif
Yep, I confirmed that with this tweak, the rest of the series worked for me with an in-tree build (again, see patch 7 for my concerns that we're still a bit too hard-coded for unusual VPATH setups).
Just to clarify, I'm okay if we push this in to get wider test coverage, while saving VPATH cleanups for someone that actually experiences problems with it (as compiling more than one directory away is not a common setup). This series is definitely an improvement, even if there are still things we can do further. Another note: you should probably update .gitignore in the appropriate patches to cover these files: # Untracked files: # (use "git add <file>..." to include in what will be committed) # # src/libvirt_probes.h # src/libvirt_qemu_probes.h # tests/virdrivermoduletest -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> libvirt_driver_nodedev.la should not link against either libvirt_util.la or gnulib.la, since libvirt.so brings in those deps. * src/Makefile.am: Fix broken linkage of libvirt_driver_nodedev.la Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/Makefile.am | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8ad6644..d15ae89 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1002,9 +1002,7 @@ libvirt_driver_nodedev_la_SOURCES = $(NODE_DEVICE_DRIVER_SOURCES) libvirt_driver_nodedev_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_nodedev_la_LDFLAGS = $(AM_LDFLAGS) -libvirt_driver_nodedev_la_LIBADD = \ - libvirt_util.la \ - ../gnulib/lib/libgnu.la +libvirt_driver_nodedev_la_LIBADD = if HAVE_HAL libvirt_driver_nodedev_la_SOURCES += $(NODE_DEVICE_DRIVER_HAL_SOURCES) -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
libvirt_driver_nodedev.la should not link against either libvirt_util.la or gnulib.la, since libvirt.so brings in those deps.
* src/Makefile.am: Fix broken linkage of libvirt_driver_nodedev.la
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/Makefile.am | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am index 8ad6644..d15ae89 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1002,9 +1002,7 @@ libvirt_driver_nodedev_la_SOURCES = $(NODE_DEVICE_DRIVER_SOURCES) libvirt_driver_nodedev_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_nodedev_la_LDFLAGS = $(AM_LDFLAGS) -libvirt_driver_nodedev_la_LIBADD = \ - libvirt_util.la \ - ../gnulib/lib/libgnu.la +libvirt_driver_nodedev_la_LIBADD =
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> The libvirt_test.la library was introduced to allow test suites to reference internal-only symbols. These days, nearly every symbol we care about is in src/libvirt_private.syms, so there is no need for libvirt_test.la to continue to exist * src/Makefile.am: Delete libvirt_test.la & add new .syms files * src/libvirt_private.syms: Export symbols needed by test suite * tests/Makefile.am: Link to libvirt_test.la. Ensure LXC tests link to network_driver.la * src/libvirt_esx.syms, src/libvirt_openvz.syms: Add exports neede by test suite --- configure.ac | 1 + src/Makefile.am | 33 +++++++++----------- src/libvirt_esx.syms | 7 ++++ src/libvirt_openvz.syms | 7 ++++ src/libvirt_private.syms | 41 ++++++++++++++++++++++++- tests/Makefile.am | 75 ++++++++++++++++++++++----------------------- 6 files changed, 107 insertions(+), 57 deletions(-) create mode 100644 src/libvirt_esx.syms create mode 100644 src/libvirt_openvz.syms diff --git a/configure.ac b/configure.ac index 06c6a4b..741a339 100644 --- a/configure.ac +++ b/configure.ac @@ -1128,6 +1128,7 @@ if test "$with_dbus" = "yes" ; then LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi +AM_CONDITIONAL([HAVE_DBUS], [test "$have_dbus" = "yes"]) dnl PolicyKit library diff --git a/src/Makefile.am b/src/Makefile.am index d15ae89..ef62e2b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1145,6 +1145,14 @@ if WITH_LINUX USED_SYM_FILES += libvirt_linux.syms endif +if HAVE_DBUS +USED_SYM_FILES += libvirt_dbus.syms +endif + +if WITH_ESX +USED_SYM_FILES += libvirt_esx.syms +endif + if WITH_LIBVIRTD USED_SYM_FILES += libvirt_daemon.syms endif @@ -1153,6 +1161,10 @@ if WITH_NWFILTER USED_SYM_FILES += libvirt_nwfilter.syms endif +if WITH_OPENVZ +USED_SYM_FILES += libvirt_openvz.syms +endif + if WITH_VMX USED_SYM_FILES += libvirt_vmx.syms endif @@ -1175,8 +1187,11 @@ EXTRA_DIST += \ libvirt_driver_modules.syms \ libvirt_daemon.syms \ libvirt_linux.syms \ + libvirt_dbus.syms \ + libvirt_esx.syms \ libvirt_network.syms \ libvirt_nwfilter.syms \ + libvirt_openvz.syms \ libvirt_sasl.syms \ libvirt_vmx.syms \ libvirt_xenxs.syms @@ -1267,24 +1282,6 @@ endif EXTRA_DIST += probes.d - -# Create an automake "convenience library" version of libvirt_la, -# just for testing, since the test harness requires access to internal -# bits and pieces that we don't want to make publicly accessible. -noinst_LTLIBRARIES += libvirt_test.la - -# Remove version script from convenience library -test_LDFLAGS = \ - $$(echo '$(libvirt_la_LDFLAGS)' \ - |sed 's!$(VERSION_SCRIPT_FLAGS)$(LIBVIRT_SYMBOL_FILE)!!' \ - |sed 's!-version-info $(LIBVIRT_VERSION_INFO)!!') - -# Just like the above, but with a slightly different set of public symbols. -libvirt_test_la_SOURCES = $(libvirt_la_SOURCES) -libvirt_test_la_LIBADD = $(libvirt_la_LIBADD) -libvirt_test_la_LDFLAGS = $(test_LDFLAGS) $(AM_LDFLAGS) -libvirt_test_la_CFLAGS = $(AM_CFLAGS) - libvirt_qemu_la_SOURCES = libvirt-qemu.c libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \ -version-info $(LIBVIRT_VERSION_INFO) \ diff --git a/src/libvirt_esx.syms b/src/libvirt_esx.syms new file mode 100644 index 0000000..163f248 --- /dev/null +++ b/src/libvirt_esx.syms @@ -0,0 +1,7 @@ +# +# These symbols are dependent upon --with-openvz via WITH_OPENVZ +# + +esxUtil_EscapeDatastoreItem; +esxVI_DateTime_ConvertToCalendarTime; +esxUtil_ParseDatastorePath; diff --git a/src/libvirt_openvz.syms b/src/libvirt_openvz.syms new file mode 100644 index 0000000..11c5587 --- /dev/null +++ b/src/libvirt_openvz.syms @@ -0,0 +1,7 @@ +# +# These symbols are dependent upon --with-openvz via WITH_OPENVZ +# + +openvzReadConfigParam; +openvzReadNetworkConf; +openvzLocateConfFile; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6c907c4..0365110 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -189,6 +189,7 @@ virCPUModeTypeToString; # datatypes.h +virGetConnect; virGetDomain; virGetDomainSnapshot; virGetInterface; @@ -431,6 +432,8 @@ virDomainRunningReasonTypeToString; virDomainSaveConfig; virDomainSaveStatus; virDomainSaveXML; +virDomainSeclabelTypeFromString; +virDomainSeclabelTypeToString; virDomainShutdownReasonTypeFromString; virDomainShutdownReasonTypeToString; virDomainShutoffReasonTypeFromString; @@ -439,6 +442,8 @@ virDomainSmartcardDefForeach; virDomainSmartcardDefFree; virDomainSmartcardTypeFromString; virDomainSmartcardTypeToString; +virDomainSmbiosModeTypeFromString; +virDomainSmbiosModeTypeToString; virDomainSnapshotAlignDisks; virDomainSnapshotAssignDef; virDomainSnapshotDefFormat; @@ -561,8 +566,16 @@ ebtablesRemoveForwardAllowIn; # event_poll.h -virEventPollToNativeEvents; +virEventPollAddHandle; +virEventPollAddTimeout; virEventPollFromNativeEvents; +virEventPollInit; +virEventPollRemoveHandle; +virEventPollRemoveTimeout; +virEventPollRunOnce; +virEventPollToNativeEvents; +virEventPollUpdateHandle; +virEventPollUpdateTimeout; # fdstream.h @@ -575,6 +588,7 @@ virFDStreamCreateFile; # hash.h virHashAddEntry; virHashCreate; +virHashEqual; virHashForEach; virHashFree; virHashGetItems; @@ -788,6 +802,7 @@ virNetworkObjIsDuplicate; virNetworkObjListFree; virNetworkObjLock; virNetworkObjUnlock; +virNetworkObjFree; virNetworkRemoveInactive; virNetworkSaveConfig; virNetworkSetBridgeMacAddr; @@ -816,6 +831,7 @@ virNodeDeviceObjUnlock; # nodeinfo.h +linuxNodeInfoCPUPopulate; nodeCapsInitNUMA; nodeGetCPUmap; nodeGetCPUStats; @@ -1068,6 +1084,7 @@ virMutexUnlock; virOnce; virThreadCreate; virThreadID; +virThreadInitialize; virThreadIsSelf; virThreadJoin; virThreadSelf; @@ -1348,16 +1365,21 @@ virNetlinkStartup; # virnetmessage.h virNetMessageClear; +virNetMessageDecodeHeader; virNetMessageDecodeNumFDs; +virNetMessageDecodeLength; +virNetMessageDecodePayload; virNetMessageDupFD; virNetMessageEncodeHeader; virNetMessageEncodePayload; +virNetMessageEncodePayloadRaw; virNetMessageEncodeNumFDs; virNetMessageFree; virNetMessageNew; virNetMessageQueuePush; virNetMessageQueueServe; virNetMessageSaveError; +xdr_virNetMessageError; # virnetserver.h @@ -1417,22 +1439,38 @@ virNetServerProgramSendStreamError; # virnetsocket.h +virNetSocketAccept; virNetSocketDupFD; virNetSocketFree; virNetSocketGetFD; virNetSocketHasPassFD; virNetSocketIsLocal; virNetSocketListen; +virNetSocketLocalAddrString; +virNetSocketNewConnectCommand; +virNetSocketNewConnectSSH; virNetSocketNewConnectTCP; +virNetSocketNewConnectUNIX; +virNetSocketNewListenTCP; virNetSocketNewListenUNIX; +virNetSocketRead; virNetSocketRecvFD; +virNetSocketRemoteAddrString; virNetSocketSendFD; +virNetSocketSetBlocking; +virNetSocketWrite; # virnettlscontext.h +virNetTLSContextCheckCertificate; virNetTLSContextFree; +virNetTLSContextNewClient; virNetTLSContextNewServer; virNetTLSContextNewServerPath; +virNetTLSSessionFree; +virNetTLSSessionHandshake; +virNetTLSSessionNew; +virNetTLSSessionSetIOCallbacks; # virnodesuspend.h @@ -1485,6 +1523,7 @@ virSocketAddrSetPort; # virterror_internal.h virDispatchError; +virErrorInitialize; virRaiseErrorFull; virReportErrorHelper; virReportOOMErrorFull; diff --git a/tests/Makefile.am b/tests/Makefile.am index 639be58..6b1f95e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -35,19 +35,10 @@ PROBES_O += ../src/probes.o endif LDADDS = \ - $(STATIC_BINARIES) \ - $(LIBXML_LIBS) \ - $(GNUTLS_LIBS) \ - $(SASL_LIBS) \ - $(SELINUX_LIBS) \ - $(APPARMOR_LIBS) \ - $(YAJL_LIBS) \ $(WARN_CFLAGS) \ - ../src/libvirt_test.la \ $(PROBES_O) \ - ../gnulib/lib/libgnu.la \ - $(LIBSOCKET) \ - $(COVERAGE_LDFLAGS) + ../src/libvirt.la \ + ../gnulib/lib/libgnu.la EXTRA_DIST = \ capabilityschemadata \ @@ -254,27 +245,30 @@ valgrind: sockettest_SOURCES = \ sockettest.c \ testutils.c testutils.h -sockettest_LDADD = ../src/libvirt_util.la $(LDADDS) +sockettest_LDADD = $(LDADDS) if WITH_XEN +xen_LDADDS = ../src/libvirt_driver_xen.la +xen_LDADDS += $(LDADDS) + xml2sexprtest_SOURCES = \ xml2sexprtest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -xml2sexprtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xml2sexprtest_LDADD = $(xen_LDADDS) sexpr2xmltest_SOURCES = \ sexpr2xmltest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -sexpr2xmltest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +sexpr2xmltest_LDADD = $(xen_LDADDS) xmconfigtest_SOURCES = \ xmconfigtest.c testutilsxen.c testutilsxen.h \ testutils.c testutils.h -xmconfigtest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xmconfigtest_LDADD = $(xen_LDADDS) xencapstest_SOURCES = \ xencapstest.c testutils.h testutils.c -xencapstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +xencapstest_LDADD = $(xen_LDADDS) reconnect_SOURCES = \ reconnect.c testutils.h testutils.c @@ -282,7 +276,7 @@ reconnect_LDADD = $(LDADDS) statstest_SOURCES = \ statstest.c testutils.h testutils.c -statstest_LDADD = ../src/libvirt_driver_xen.la $(LDADDS) +statstest_LDADD = $(xen_LDADDS) else EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \ @@ -293,41 +287,41 @@ endif if WITH_QEMU qemu_LDADDS = ../src/libvirt_driver_qemu.la - if WITH_NETWORK qemu_LDADDS += ../src/libvirt_driver_network.la endif +qemu_LDADDS += $(LDADDS) qemuxml2argvtest_SOURCES = \ qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -qemuxml2argvtest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemuxml2argvtest_LDADD = $(qemu_LDADDS) qemuxml2xmltest_SOURCES = \ qemuxml2xmltest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -qemuxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemuxml2xmltest_LDADD = $(qemu_LDADDS) qemuxmlnstest_SOURCES = \ qemuxmlnstest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -qemuxmlnstest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemuxmlnstest_LDADD = $(qemu_LDADDS) qemuargv2xmltest_SOURCES = \ qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -qemuargv2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemuargv2xmltest_LDADD = $(qemu_LDADDS) qemuhelptest_SOURCES = qemuhelptest.c testutils.c testutils.h -qemuhelptest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemuhelptest_LDADD = $(qemu_LDADDS) qemumonitortest_SOURCES = qemumonitortest.c testutils.c testutils.h -qemumonitortest_LDADD = $(qemu_LDADDS) $(LDADDS) +qemumonitortest_LDADD = $(qemu_LDADDS) domainsnapshotxml2xmltest_SOURCES = \ domainsnapshotxml2xmltest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h -domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) $(LDADDS) +domainsnapshotxml2xmltest_LDADD = $(qemu_LDADDS) else EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \ qemuxmlnstest.c qemuhelptest.c domainsnapshotxml2xmltest.c \ @@ -337,11 +331,15 @@ endif if WITH_LXC lxc_LDADDS = ../src/libvirt_driver_lxc.la +if WITH_NETWORK +lxc_LDADDS += ../src/libvirt_driver_network.la +endif +lxc_LDADDS += $(LDADDS) lxcxml2xmltest_SOURCES = \ lxcxml2xmltest.c testutilslxc.c testutilslxc.h \ testutils.c testutils.h -lxcxml2xmltest_LDADD = $(lxc_LDADDS) $(LDADDS) +lxcxml2xmltest_LDADD = $(lxc_LDADDS) else EXTRA_DIST += lxcxml2xmltest.c testutilslxc.c testutilslxc.h endif @@ -350,7 +348,7 @@ if WITH_OPENVZ openvzutilstest_SOURCES = \ openvzutilstest.c \ testutils.c testutils.h -openvzutilstest_LDADD = ../src/libvirt_driver_openvz.la $(LDADDS) +openvzutilstest_LDADD = $(LDADDS) else EXTRA_DIST += openvzutilstest.c endif @@ -360,7 +358,7 @@ if WITH_ESX esxutilstest_SOURCES = \ esxutilstest.c \ testutils.c testutils.h -esxutilstest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS) +esxutilstest_LDADD = $(LDADDS) else EXTRA_DIST += esxutilstest.c endif @@ -369,12 +367,12 @@ if WITH_VMX vmx2xmltest_SOURCES = \ vmx2xmltest.c \ testutils.c testutils.h -vmx2xmltest_LDADD = ../src/libvirt_vmx.la $(LDADDS) +vmx2xmltest_LDADD = $(LDADDS) xml2vmxtest_SOURCES = \ xml2vmxtest.c \ testutils.c testutils.h -xml2vmxtest_LDADD = ../src/libvirt_vmx.la $(LDADDS) +xml2vmxtest_LDADD = $(LDADDS) else EXTRA_DIST += vmx2xmltest.c xml2vmxtest.c endif @@ -445,6 +443,7 @@ commandhelper_SOURCES = \ commandhelper.c commandhelper_CFLAGS = -Dabs_builddir="\"`pwd`\"" $(AM_CFLAGS) commandhelper_LDADD = $(LDADDS) +commandhelper_LDFLAGS = -static if WITH_LIBVIRTD libvirtdconftest_SOURCES = \ @@ -460,17 +459,17 @@ virnetmessagetest_SOURCES = \ virnetmessagetest.c testutils.h testutils.c virnetmessagetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" \ $(XDR_CFLAGS) $(AM_CFLAGS) -virnetmessagetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virnetmessagetest_LDADD = $(LDADDS) virnetsockettest_SOURCES = \ virnetsockettest.c testutils.h testutils.c virnetsockettest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -virnetsockettest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virnetsockettest_LDADD = $(LDADDS) virnettlscontexttest_SOURCES = \ virnettlscontexttest.c testutils.h testutils.c virnettlscontexttest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -virnettlscontexttest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virnettlscontexttest_LDADD = $(LDADDS) if HAVE_LIBTASN1 virnettlscontexttest_SOURCES += pkix_asn1_tab.c virnettlscontexttest_LDADD += -ltasn1 @@ -481,26 +480,26 @@ endif virtimetest_SOURCES = \ virtimetest.c testutils.h testutils.c virtimetest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -virtimetest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virtimetest_LDADD = $(LDADDS) viruritest_SOURCES = \ viruritest.c testutils.h testutils.c viruritest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -viruritest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +viruritest_LDADD = $(LDADDS) virkeyfiletest_SOURCES = \ virkeyfiletest.c testutils.h testutils.c virkeyfiletest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -virkeyfiletest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virkeyfiletest_LDADD = $(LDADDS) virauthconfigtest_SOURCES = \ virauthconfigtest.c testutils.h testutils.c virauthconfigtest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) -virauthconfigtest_LDADD = ../src/libvirt-net-rpc.la $(LDADDS) +virauthconfigtest_LDADD = $(LDADDS) seclabeltest_SOURCES = \ seclabeltest.c -seclabeltest_LDADD = ../src/libvirt_driver_security.la $(LDADDS) +seclabeltest_LDADD = $(LDADDS) virbuftest_SOURCES = \ virbuftest.c testutils.h testutils.c -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The libvirt_test.la library was introduced to allow test suites to reference internal-only symbols. These days, nearly every symbol we care about is in src/libvirt_private.syms, so there is no need for libvirt_test.la to continue to exist
* src/Makefile.am: Delete libvirt_test.la & add new .syms files * src/libvirt_private.syms: Export symbols needed by test suite * tests/Makefile.am: Link to libvirt_test.la. Ensure LXC tests link to network_driver.la * src/libvirt_esx.syms, src/libvirt_openvz.syms: Add exports neede
s/neede/needed/
by test suite --- configure.ac | 1 + src/Makefile.am | 33 +++++++++----------- src/libvirt_esx.syms | 7 ++++ src/libvirt_openvz.syms | 7 ++++ src/libvirt_private.syms | 41 ++++++++++++++++++++++++- tests/Makefile.am | 75 ++++++++++++++++++++++----------------------- 6 files changed, 107 insertions(+), 57 deletions(-) create mode 100644 src/libvirt_esx.syms create mode 100644 src/libvirt_openvz.syms
Alas, this isn't passing for me: CCLD libvirt.la *** Warning: Linking the shared library libvirt.la against the non-libtool *** objects probes.o is not portable! ../gnulib/lib/.libs/libgnu.a(allocator.o):(.data.rel.ro+0x0): multiple definition of `stdlib_allocator' ./.libs/libvirt_driver_xenapi.a(allocator.o):(.data.rel.ro+0x0): first defined here ... I'm not sure where we have a duplicate link line, but there's obviously still something that needs trimming.
+++ b/src/libvirt_esx.syms @@ -0,0 +1,7 @@ +# +# These symbols are dependent upon --with-openvz via WITH_OPENVZ
Really? [Too much copy-and-paste] Other than that, things look reasonable, but it's hard to know for sure without a full test. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Only libvirt_driver_storage.la links to libblkid currently. If we are running in a scenario with driver modules, LXC must directly link to it, since it can't assume the storage driver is present Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/Makefile.am | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index ef62e2b..ff3eaec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -797,6 +797,10 @@ libvirt_driver_lxc_la_CFLAGS = \ $(LIBNL_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS) $(LIBNL_LIBS) +if HAVE_LIBBLKID +libvirt_driver_lxc_la_CFLAGS += $(BLKID_CFLAGS) +libvirt_driver_lxc_la_LIBADD += $(BLKID_LIBS) +endif if WITH_SECDRIVER_SELINUX libvirt_driver_lxc_la_LIBADD += $(SELINUX_LIBS) endif -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Only libvirt_driver_storage.la links to libblkid currently. If we are running in a scenario with driver modules, LXC must directly link to it, since it can't assume the storage driver is present
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/Makefile.am | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am index ef62e2b..ff3eaec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -797,6 +797,10 @@ libvirt_driver_lxc_la_CFLAGS = \ $(LIBNL_CFLAGS) \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS) $(LIBNL_LIBS) +if HAVE_LIBBLKID +libvirt_driver_lxc_la_CFLAGS += $(BLKID_CFLAGS) +libvirt_driver_lxc_la_LIBADD += $(BLKID_LIBS) +endif
ACK. (As with the rest of this series, I didn't compile-test past 3/10, so I hope it works; but it looks reasonable). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Since we have drivers which depend on each other (ie QEMU/LXC depend on the network driver APIs), we need to use RTLD_GLOBAL instead of RTLD_LOCAL. While this pollutes the calling binary with many more symbols, this is no worse than if we directly link to the drivers, and this only applies to libvirtd * src/driver.c: s/RTLD_LOCAL/RTLD_GLOBAL/ Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/driver.c b/src/driver.c index 5034277..fb162e0 100644 --- a/src/driver.c +++ b/src/driver.c @@ -59,7 +59,7 @@ virDriverLoadModule(const char *name) goto cleanup; } - handle = dlopen(modfile, RTLD_NOW | RTLD_LOCAL); + handle = dlopen(modfile, RTLD_NOW | RTLD_GLOBAL); if (!handle) { VIR_ERROR(_("failed to load module %s %s"), modfile, dlerror()); goto cleanup; -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Since we have drivers which depend on each other (ie QEMU/LXC depend on the network driver APIs), we need to use RTLD_GLOBAL instead of RTLD_LOCAL. While this pollutes the calling binary with many more symbols, this is no worse than if we directly link to the drivers, and this only applies to libvirtd
* src/driver.c: s/RTLD_LOCAL/RTLD_GLOBAL/
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/driver.c b/src/driver.c index 5034277..fb162e0 100644 --- a/src/driver.c +++ b/src/driver.c @@ -59,7 +59,7 @@ virDriverLoadModule(const char *name) goto cleanup; }
- handle = dlopen(modfile, RTLD_NOW | RTLD_LOCAL); + handle = dlopen(modfile, RTLD_NOW | RTLD_GLOBAL);
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> When building as driver modules, it is not possible for the QEMU driver module to reference the DTrace/SystemTAP probes linked into the main libvirt.so. Thus we need to move the QEMU probes into a separate file 'libvirt_qemu_probes.d'. Also rename the existing file from 'probes.d' to 'libvirt_probes.d' while we're at it * daemon/Makefile.am, src/internal.h: Include libvirt_probes.h instead of probes.h * src/Makefile.am: Add rules for libvirt_qemu_probes.d * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Include libvirt_qemu_probes.h * src/libvirt_probes.d: Rename from probes.d * src/libvirt_qemu_probes.d: QEMU specific probes formerly in probes.d Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/Makefile.am | 5 ++- src/Makefile.am | 40 +++++++++++----- src/internal.h | 2 +- src/libvirt_probes.d | 85 +++++++++++++++++++++++++++++++++ src/libvirt_qemu_probes.d | 21 ++++++++ src/probes.d | 106 ------------------------------------------ src/qemu/qemu_monitor.c | 4 ++ src/qemu/qemu_monitor_json.c | 4 ++ src/qemu/qemu_monitor_text.c | 4 ++ tests/Makefile.am | 5 ++- 10 files changed, 154 insertions(+), 122 deletions(-) create mode 100644 src/libvirt_probes.d create mode 100644 src/libvirt_qemu_probes.d delete mode 100644 src/probes.d diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 24cce8f..5d4c1a7 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -112,7 +112,7 @@ libvirtd_LDADD = \ $(POLKIT_LIBS) if WITH_DTRACE_PROBES -libvirtd_LDADD += ../src/probes.o +libvirtd_LDADD += ../src/libvirt_probes.o endif libvirtd_LDADD += \ @@ -121,6 +121,9 @@ libvirtd_LDADD += \ if ! WITH_DRIVER_MODULES if WITH_QEMU libvirtd_LDADD += ../src/libvirt_driver_qemu.la +if WITH_DTRACE_PROBES + libvirtd_LDADD += ../src/libvirt_qemu_probes.o +endif endif if WITH_LXC diff --git a/src/Makefile.am b/src/Makefile.am index ff3eaec..954c6e9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1252,22 +1252,30 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS) libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE) if WITH_DTRACE_PROBES -libvirt_la_BUILT_LIBADD += probes.o -libvirt_la_DEPENDENCIES += probes.o -nodist_libvirt_la_SOURCES = probes.h +libvirt_la_BUILT_LIBADD += libvirt_probes.o +libvirt_la_DEPENDENCIES += libvirt_probes.o +nodist_libvirt_la_SOURCES = libvirt_probes.h if WITH_REMOTE -$(REMOTE_DRIVER_GENERATED): probes.h +$(REMOTE_DRIVER_GENERATED): libvirt_probes.h endif WITH_REMOTE -BUILT_SOURCES += probes.h libvirt_probes.stp libvirt_functions.stp +BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp + +if WITH_QEMU +libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.o +nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h +libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.o + +$(libvirt_driver_qemu_la_SOURCES): libvirt_qemu_probes.h +endif tapsetdir = $(datadir)/systemtap/tapset -tapset_DATA = libvirt_probes.stp libvirt_functions.stp +tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp libvirt_functions.stp -probes.h: probes.d +%_probes.h: %_probes.d $(AM_V_GEN)$(DTRACE) -o $@ -h -s $< -probes.o: probes.d +%_probes.o: %_probes.d $(AM_V_GEN)$(DTRACE) -o $@ -G -s $< RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \ @@ -1278,13 +1286,19 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \ libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl $(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@ -libvirt_probes.stp: probes.d $(srcdir)/dtrace2systemtap.pl +libvirt_probes.stp: libvirt_probes.d $(srcdir)/dtrace2systemtap.pl + $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@ + +libvirt_qemu_probes.stp: libvirt_qemu_probes.d $(srcdir)/dtrace2systemtap.pl $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $< > $@ -CLEANFILES += probes.h probes.o libvirt_functions.stp libvirt_probes.stp +CLEANFILES += libvirt_probes.h libvirt_probes.o \ + libvirt_qemu_probes.h libvirt_qemu_probes.o \ + libvirt_functions.stp libvirt_probes.stp \ + libvirt_qemu_probes.stp endif -EXTRA_DIST += probes.d +EXTRA_DIST += libvirt_probes.d libvirt_qemu_probes.d libvirt_qemu_la_SOURCES = libvirt-qemu.c libvirt_qemu_la_LDFLAGS = $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_QEMU_SYMBOL_FILE) \ @@ -1471,7 +1485,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \ $(RT_LIBS) $(DBUS_LIBS) \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES -libvirt_lxc_LDADD += probes.o +libvirt_lxc_LDADD += libvirt_probes.o endif if WITH_SECDRIVER_SELINUX libvirt_lxc_LDADD += $(SELINUX_LIBS) @@ -1516,7 +1530,7 @@ virt_aa_helper_LDADD = \ libvirt_util.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES -virt_aa_helper_LDADD += probes.o +virt_aa_helper_LDADD += libvirt_probes.o endif virt_aa_helper_CFLAGS = \ -I$(top_srcdir)/src/conf \ diff --git a/src/internal.h b/src/internal.h index 83f468d..d13847a 100644 --- a/src/internal.h +++ b/src/internal.h @@ -250,7 +250,7 @@ # if WITH_DTRACE_PROBES # ifndef LIBVIRT_PROBES_H # define LIBVIRT_PROBES_H -# include "probes.h" +# include "libvirt_probes.h" # endif /* LIBVIRT_PROBES_H */ /* Systemtap 1.2 headers have a bug where they cannot handle a diff --git a/src/libvirt_probes.d b/src/libvirt_probes.d new file mode 100644 index 0000000..ac6c546 --- /dev/null +++ b/src/libvirt_probes.d @@ -0,0 +1,85 @@ +provider libvirt { + # file: src/util/event_poll.c + # prefix: event_poll + probe event_poll_add_handle(int watch, int fd, int events, void *cb, void *opaque, void *ff); + probe event_poll_update_handle(int watch, int events); + probe event_poll_remove_handle(int watch); + probe event_poll_dispatch_handle(int watch, int events); + probe event_poll_purge_handle(int watch); + + probe event_poll_add_timeout(int timer, int frequency, void *cb, void *opaque, void *ff); + probe event_poll_update_timeout(int timer, int frequency); + probe event_poll_remove_timeout(int timer); + probe event_poll_dispatch_timeout(int timer); + probe event_poll_purge_timeout(int timer); + + probe event_poll_run(int nfds, int timeout); + + + # file: src/rpc/virnetsocket.c + # prefix: rpc + probe rpc_socket_new(void *sock, int refs, int fd, int errfd, pid_t pid, const char *localAddr, const char *remoteAddr); + probe rpc_socket_send_fd(void *sock, int fd); + probe rpc_socket_recv_fd(void *sock, int fd); + probe rpc_socket_ref(void *sock, int refs); + probe rpc_socket_free(void *sock, int refs); + + + # file: src/rpc/virnetserverclient.c + # prefix: rpc + probe rpc_server_client_new(void *client, int refs, void *sock); + probe rpc_server_client_ref(void *client, int refs); + probe rpc_server_client_free(void *client, int refs); + + probe rpc_server_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); + probe rpc_server_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); + + + # file: src/rpc/virnetclient.c + # prefix: rpc + probe rpc_client_new(void *client, int refs, void *sock); + probe rpc_client_ref(void *client, int refs); + probe rpc_client_free(void *client, int refs); + + probe rpc_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); + probe rpc_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); + + + # file: daemon/libvirtd.c + # prefix: rpc + probe rpc_server_client_auth_allow(void *client, int authtype, const char *identity); + probe rpc_server_client_auth_deny(void *client, int authtype, const char *identity); + probe rpc_server_client_auth_fail(void *client, int authtype); + + + # file: src/rpc/virnettlscontext.c + # prefix: rpc + probe rpc_tls_context_new(void *ctxt, int refs, const char *cacert, const char *cacrl, + const char *cert, const char *key, int sanityCheckCert, int requireValidCert, int isServer); + probe rpc_tls_context_ref(void *ctxt, int refs); + probe rpc_tls_context_free(void *ctxt, int refs); + + probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname); + probe rpc_tls_context_session_deny(void *ctxt, void *sess, const char *dname); + probe rpc_tls_context_session_fail(void *ctxt, void *sess); + + + probe rpc_tls_session_new(void *sess, void *ctxt, int refs, const char *hostname, int isServer); + probe rpc_tls_session_ref(void *sess, int refs); + probe rpc_tls_session_free(void *sess, int refs); + + probe rpc_tls_session_handshake_pass(void *sess); + probe rpc_tls_session_handshake_fail(void *sess); + + + # file: src/rpc/virkeepalive.c + # prefix: rpc + probe rpc_keepalive_new(void *ka, void *client, int refs); + probe rpc_keepalive_ref(void *ka, void *client, int refs); + probe rpc_keepalive_free(void *ka, void *client, int refs); + probe rpc_keepalive_start(void *ka, void *client, int interval, int count); + probe rpc_keepalive_stop(void *ka, void *client, bool all); + probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc); + probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc); + probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle); +}; diff --git a/src/libvirt_qemu_probes.d b/src/libvirt_qemu_probes.d new file mode 100644 index 0000000..6916778 --- /dev/null +++ b/src/libvirt_qemu_probes.d @@ -0,0 +1,21 @@ +provider libvirt { + # file: src/qemu/qemu_monitor.c + # prefix: qemu + # binary: libvirtd + # Monitor lifecycle + probe qemu_monitor_new(void *mon, int refs, int fd); + probe qemu_monitor_ref(void *mon, int refs); + probe qemu_monitor_unref(void *mon, int refs); + probe qemu_monitor_close(void *monm, int refs); + + # High level monitor message processing + probe qemu_monitor_send_msg(void *mon, const char *msg, int fd); + probe qemu_monitor_recv_reply(void *mon, const char *reply); + probe qemu_monitor_recv_event(void *mon, const char *event); + + # Low level monitor I/O processing + probe qemu_monitor_io_process(void *mon, const char *buf, unsigned int len); + probe qemu_monitor_io_read(void *mon, const char *buf, unsigned int len, int ret, int errno); + probe qemu_monitor_io_write(void *mon, const char *buf, unsigned int len, int ret, int errno); + probe qemu_monitor_io_send_fd(void *mon, int fd, int ret, int errno); +}; diff --git a/src/probes.d b/src/probes.d deleted file mode 100644 index e56dc3e..0000000 --- a/src/probes.d +++ /dev/null @@ -1,106 +0,0 @@ -provider libvirt { - # file: src/util/event_poll.c - # prefix: event_poll - probe event_poll_add_handle(int watch, int fd, int events, void *cb, void *opaque, void *ff); - probe event_poll_update_handle(int watch, int events); - probe event_poll_remove_handle(int watch); - probe event_poll_dispatch_handle(int watch, int events); - probe event_poll_purge_handle(int watch); - - probe event_poll_add_timeout(int timer, int frequency, void *cb, void *opaque, void *ff); - probe event_poll_update_timeout(int timer, int frequency); - probe event_poll_remove_timeout(int timer); - probe event_poll_dispatch_timeout(int timer); - probe event_poll_purge_timeout(int timer); - - probe event_poll_run(int nfds, int timeout); - - - # file: src/rpc/virnetsocket.c - # prefix: rpc - probe rpc_socket_new(void *sock, int refs, int fd, int errfd, pid_t pid, const char *localAddr, const char *remoteAddr); - probe rpc_socket_send_fd(void *sock, int fd); - probe rpc_socket_recv_fd(void *sock, int fd); - probe rpc_socket_ref(void *sock, int refs); - probe rpc_socket_free(void *sock, int refs); - - - # file: src/rpc/virnetserverclient.c - # prefix: rpc - probe rpc_server_client_new(void *client, int refs, void *sock); - probe rpc_server_client_ref(void *client, int refs); - probe rpc_server_client_free(void *client, int refs); - - probe rpc_server_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); - probe rpc_server_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); - - - # file: src/rpc/virnetclient.c - # prefix: rpc - probe rpc_client_new(void *client, int refs, void *sock); - probe rpc_client_ref(void *client, int refs); - probe rpc_client_free(void *client, int refs); - - probe rpc_client_msg_tx_queue(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); - probe rpc_client_msg_rx(void *client, int len, int prog, int vers, int proc, int type, int status, int serial); - - - # file: daemon/libvirtd.c - # prefix: rpc - probe rpc_server_client_auth_allow(void *client, int authtype, const char *identity); - probe rpc_server_client_auth_deny(void *client, int authtype, const char *identity); - probe rpc_server_client_auth_fail(void *client, int authtype); - - - # file: src/rpc/virnettlscontext.c - # prefix: rpc - probe rpc_tls_context_new(void *ctxt, int refs, const char *cacert, const char *cacrl, - const char *cert, const char *key, int sanityCheckCert, int requireValidCert, int isServer); - probe rpc_tls_context_ref(void *ctxt, int refs); - probe rpc_tls_context_free(void *ctxt, int refs); - - probe rpc_tls_context_session_allow(void *ctxt, void *sess, const char *dname); - probe rpc_tls_context_session_deny(void *ctxt, void *sess, const char *dname); - probe rpc_tls_context_session_fail(void *ctxt, void *sess); - - - probe rpc_tls_session_new(void *sess, void *ctxt, int refs, const char *hostname, int isServer); - probe rpc_tls_session_ref(void *sess, int refs); - probe rpc_tls_session_free(void *sess, int refs); - - probe rpc_tls_session_handshake_pass(void *sess); - probe rpc_tls_session_handshake_fail(void *sess); - - - # file: src/rpc/virkeepalive.c - # prefix: rpc - probe rpc_keepalive_new(void *ka, void *client, int refs); - probe rpc_keepalive_ref(void *ka, void *client, int refs); - probe rpc_keepalive_free(void *ka, void *client, int refs); - probe rpc_keepalive_start(void *ka, void *client, int interval, int count); - probe rpc_keepalive_stop(void *ka, void *client, bool all); - probe rpc_keepalive_send(void *ka, void *client, int prog, int vers, int proc); - probe rpc_keepalive_received(void *ka, void *client, int prog, int vers, int proc); - probe rpc_keepalive_timeout(void *ka, void *client, int coundToDeath, int idle); - - - # file: src/qemu/qemu_monitor.c - # prefix: qemu - # binary: libvirtd - # Monitor lifecycle - probe qemu_monitor_new(void *mon, int refs, int fd); - probe qemu_monitor_ref(void *mon, int refs); - probe qemu_monitor_unref(void *mon, int refs); - probe qemu_monitor_close(void *monm, int refs); - - # High level monitor message processing - probe qemu_monitor_send_msg(void *mon, const char *msg, int fd); - probe qemu_monitor_recv_reply(void *mon, const char *reply); - probe qemu_monitor_recv_event(void *mon, const char *event); - - # Low level monitor I/O processing - probe qemu_monitor_io_process(void *mon, const char *buf, unsigned int len); - probe qemu_monitor_io_read(void *mon, const char *buf, unsigned int len, int ret, int errno); - probe qemu_monitor_io_write(void *mon, const char *buf, unsigned int len, int ret, int errno); - probe qemu_monitor_io_send_fd(void *mon, int fd, int ret, int errno); -}; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 7d69c67..7084c68 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -37,6 +37,10 @@ #include "logging.h" #include "virfile.h" +#ifdef WITH_DTRACE_PROBES +# include "libvirt_qemu_probes.h" +#endif + #define VIR_FROM_THIS VIR_FROM_QEMU #define DEBUG_IO 0 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e1f5453..9030347 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -43,6 +43,10 @@ #include "json.h" #include "ignore-value.h" +#ifdef WITH_DTRACE_PROBES +# include "libvirt_qemu_probes.h" +#endif + #define VIR_FROM_THIS VIR_FROM_QEMU diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 9e2991b..edb5dfd 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -41,6 +41,10 @@ #include "virterror_internal.h" #include "buf.h" +#ifdef WITH_DTRACE_PROBES +# include "libvirt_qemu_probes.h" +#endif + #define VIR_FROM_THIS VIR_FROM_QEMU #define QEMU_CMD_PROMPT "\n(qemu) " diff --git a/tests/Makefile.am b/tests/Makefile.am index 6b1f95e..4575a56 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -31,7 +31,7 @@ endif PROBES_O = if WITH_DTRACE_PROBES -PROBES_O += ../src/probes.o +PROBES_O += ../src/libvirt_probes.o endif LDADDS = \ @@ -290,6 +290,9 @@ qemu_LDADDS = ../src/libvirt_driver_qemu.la if WITH_NETWORK qemu_LDADDS += ../src/libvirt_driver_network.la endif +if WITH_DTRACE_PROBES +qemu_LDADDS += ../src/libvirt_qemu_probes.o +endif qemu_LDADDS += $(LDADDS) qemuxml2argvtest_SOURCES = \ -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
When building as driver modules, it is not possible for the QEMU driver module to reference the DTrace/SystemTAP probes linked into the main libvirt.so. Thus we need to move the QEMU probes into a separate file 'libvirt_qemu_probes.d'. Also rename the existing file from 'probes.d' to 'libvirt_probes.d' while we're at it
* daemon/Makefile.am, src/internal.h: Include libvirt_probes.h instead of probes.h * src/Makefile.am: Add rules for libvirt_qemu_probes.d * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Include libvirt_qemu_probes.h * src/libvirt_probes.d: Rename from probes.d * src/libvirt_qemu_probes.d: QEMU specific probes formerly in probes.d
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> * daemon/libvirtd.c: Set custom driver module dir if the current binary name is 'lt-libvirtd' (indicating execution directly from GIT checkout) * src/driver.c, src/driver.h, src/libvirt_driver_modules.syms: Add virDriverModuleInitialize to allow driver module location to be changed Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/libvirtd.c | 6 ++++++ src/driver.c | 18 ++++++++++++++++-- src/driver.h | 1 + src/libvirt_driver_modules.syms | 1 + 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 1e91a45..943fef4 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -958,6 +958,12 @@ int main(int argc, char **argv) { /* initialize early logging */ virLogSetFromEnv(); +#ifdef WITH_DRIVER_MODULES + if (strstr(argv[0], "lt-libvirtd") && + (access("./.git", R_OK) >= 0 || access("../.git", R_OK) >= 0)) + virDriverModuleInitialize("./src/.libs"); +#endif + while (1) { int optidx = 0; int c; diff --git a/src/driver.c b/src/driver.c index fb162e0..da4bee5 100644 --- a/src/driver.c +++ b/src/driver.c @@ -38,16 +38,30 @@ # include <dlfcn.h> +static const char *moddir = NULL; + +void +virDriverModuleInitialize(const char *defmoddir) +{ + const char *custommoddir = getenv("LIBVIRT_DRIVER_DIR"); + if (custommoddir) + moddir = custommoddir; + else if (defmoddir) + moddir = defmoddir; + else + moddir = DEFAULT_DRIVER_DIR; + VIR_DEBUG("Module dir %s", moddir); +} + void * virDriverLoadModule(const char *name) { - const char *moddir = getenv("LIBVIRT_DRIVER_DIR"); char *modfile = NULL, *regfunc = NULL; void *handle = NULL; int (*regsym)(void); if (moddir == NULL) - moddir = DEFAULT_DRIVER_DIR; + virDriverModuleInitialize(NULL); VIR_DEBUG("Module load %s", name); diff --git a/src/driver.h b/src/driver.h index 03d249b..aa7a377 100644 --- a/src/driver.h +++ b/src/driver.h @@ -1621,6 +1621,7 @@ int virRegisterNWFilterDriver(virNWFilterDriverPtr); # ifdef WITH_LIBVIRTD int virRegisterStateDriver(virStateDriverPtr); # endif +void virDriverModuleInitialize(const char *defmoddir); void *virDriverLoadModule(const char *name); #endif /* __VIR_DRIVER_H__ */ diff --git a/src/libvirt_driver_modules.syms b/src/libvirt_driver_modules.syms index ce8d9b8..a5dd58b 100644 --- a/src/libvirt_driver_modules.syms +++ b/src/libvirt_driver_modules.syms @@ -5,3 +5,4 @@ # driver.h virDriverLoadModule; +virDriverModuleInitialize; -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
* daemon/libvirtd.c: Set custom driver module dir if the current binary name is 'lt-libvirtd' (indicating execution directly from GIT checkout) * src/driver.c, src/driver.h, src/libvirt_driver_modules.syms: Add virDriverModuleInitialize to allow driver module location to be changed
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/libvirtd.c | 6 ++++++ src/driver.c | 18 ++++++++++++++++-- src/driver.h | 1 + src/libvirt_driver_modules.syms | 1 + 4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 1e91a45..943fef4 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -958,6 +958,12 @@ int main(int argc, char **argv) { /* initialize early logging */ virLogSetFromEnv();
+#ifdef WITH_DRIVER_MODULES + if (strstr(argv[0], "lt-libvirtd") &&
This is not portable to cygwin. Then again, I haven't yet got libvirtd to compile on cygwin, so I don't know if it really matters. Supposedly, libtool has features to make it easier to run in-tree builds, but I'd have to research if any of those were any easier than what you've just hard-coded in.
+ (access("./.git", R_OK) >= 0 || access("../.git", R_OK) >= 0)) + virDriverModuleInitialize("./src/.libs");
This is hard-coded to a very limited set of build setups (that is, it won't work with all possible VPATH builds). Can we somehow get at $srcdir from Makefile and turn it into a #define or an environment variable, so that we are making only a single probe of the correct directory regardless of what VPATH build we used? Is this something where we need to write a wrapper script around the libtool wrapper that adds an extra command line argument to libvirtd? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> To ensure all symbols used by loadable driver modules are exported in libvirt.so, add a test suite that simply loads each driver in turn * tests/Makefile.am, tests/virdrivermoduletest.c: Add a test case for loading drivers Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- tests/Makefile.am | 11 +++++ tests/virdrivermoduletest.c | 104 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 0 deletions(-) create mode 100644 tests/virdrivermoduletest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 4575a56..c7addde 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -93,6 +93,10 @@ test_programs = virshtest sockettest \ virtimetest viruritest virkeyfiletest \ virauthconfigtest +if WITH_DRIVER_MODULES +test_programs += virdrivermoduletest +endif + # This is a fake SSH we use from virnetsockettest ssh_SOURCES = ssh.c ssh_LDADD = $(COVERAGE_LDFLAGS) @@ -520,6 +524,13 @@ utiltest_SOURCES = \ utiltest.c testutils.h testutils.c utiltest_LDADD = $(LDADDS) +if WITH_DRIVER_MODULES +virdrivermoduletest_SOURCES = \ + virdrivermoduletest.c testutils.h testutils.c +virdrivermoduletest_CFLAGS = -Dabs_builddir="\"$(abs_builddir)\"" $(AM_CFLAGS) +virdrivermoduletest_LDADD = $(LDADDS) +endif + if WITH_LIBVIRTD eventtest_SOURCES = \ eventtest.c testutils.h testutils.c diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c new file mode 100644 index 0000000..405574e --- /dev/null +++ b/tests/virdrivermoduletest.c @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2012 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Daniel P. Berrange <berrange@redhat.com> + */ + +#include <config.h> + +#include "testutils.h" +#include "util.h" +#include "virterror_internal.h" +#include "memory.h" +#include "logging.h" +#include "driver.h" + +#define VIR_FROM_THIS VIR_FROM_NONE + +struct testDriverData { + const char *name; + const char *dep1; +}; + + +static int testDriverModule(const void *args) +{ + const struct testDriverData *data = args; + + if (data->dep1 && + !virDriverLoadModule(data->dep1)) + return -1; + + if (!virDriverLoadModule(data->name)) + return -1; + + return 0; +} + + +static int +mymain(void) +{ + int ret = 0; + +#define TEST(name, dep1) \ + do { \ + const struct testDriverData data = { name, dep1 }; \ + if (virtTestRun("Test driver " # name, 1, testDriverModule, &data) < 0) \ + ret = -1; \ + } while (0) + + virDriverModuleInitialize(abs_builddir "/../src/.libs"); + +#ifdef WITH_NETWORK + TEST("network", NULL); +#endif +#ifdef WITH_STORAGE + TEST("storage", NULL); +#endif +#ifdef WITH_NODE_DEVICES + TEST("nodedev", NULL); +#endif +#ifdef WITH_SECRETS + TEST("secret", NULL); +#endif +#ifdef WITH_NWFILTER + TEST("nwfilter", NULL); +#endif +#ifdef WITH_INTERFACE + TEST("interface", NULL); +#endif +#ifdef WITH_QEMU + TEST("qemu", "network"); +#endif +#ifdef WITH_LXC + TEST("lxc", "network"); +#endif +#ifdef WITH_UML + TEST("uml", NULL); +#endif +#ifdef WITH_XEN + TEST("xen", NULL); +#endif +#ifdef WITH_LIBXL + TEST("libxl", NULL); +#endif + + return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIRT_TEST_MAIN(mymain) -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
To ensure all symbols used by loadable driver modules are exported in libvirt.so, add a test suite that simply loads each driver in turn
* tests/Makefile.am, tests/virdrivermoduletest.c: Add a test case for loading drivers
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- tests/Makefile.am | 11 +++++ tests/virdrivermoduletest.c | 104 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 0 deletions(-) create mode 100644 tests/virdrivermoduletest.c
ACK.
+static int testDriverModule(const void *args) +{ + const struct testDriverData *data = args; + + if (data->dep1 && + !virDriverLoadModule(data->dep1)) + return -1; + + if (!virDriverLoadModule(data->name)) + return -1; + + return 0; +}
Any reason why we don't have a virDriverUnloadModule? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, May 21, 2012 at 09:56:19PM -0600, Eric Blake wrote:
On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
To ensure all symbols used by loadable driver modules are exported in libvirt.so, add a test suite that simply loads each driver in turn
* tests/Makefile.am, tests/virdrivermoduletest.c: Add a test case for loading drivers
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- tests/Makefile.am | 11 +++++ tests/virdrivermoduletest.c | 104 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 0 deletions(-) create mode 100644 tests/virdrivermoduletest.c
ACK.
+static int testDriverModule(const void *args) +{ + const struct testDriverData *data = args; + + if (data->dep1 && + !virDriverLoadModule(data->dep1)) + return -1; + + if (!virDriverLoadModule(data->name)) + return -1; + + return 0; +}
Any reason why we don't have a virDriverUnloadModule?
Unloading dynamic libraries can trigger a world of hurt in threaded applications which use thread locals. eg this previous fix: commit 8e44e5593eb9b89fbc0b54fde15f130707a0d81e Author: Daniel P. Berrange <berrange@redhat.com> Date: Thu Sep 1 17:57:06 2011 +0100 Prevent crash from dlclose() of libvirt.so When libvirt calls virInitialize it creates a thread local for the virErrorPtr storage, and registers a callback to cleanup memory when a thread exits. When libvirt is dlclose()d or otherwise made non-resident, the callback function is removed from memory, but the thread local may still exist and if a thread later exists, it will invoke the callback and SEGV. There may also be other thread locals with callbacks pointing to libvirt code, so it is in general never safe to unload libvirt.so from memory once initialized. To allow dlclose() to succeed, but keep libvirt.so resident in memory, link with '-z nodelete'. This issue was first found with the libvirt CIM provider, but can potentially hit many of the dynamic language bindings which all ultimately involve dlopen() in some way, either on libvirt.so itself, or on the glue code for the binding which in turns links to libvirt while this applied to libvirt.so used by client applcations, IMHO, the same problem exists wrt to libvirtd & loadable driver modules. Since I see no compelling reason to unload modules, it is safer to just not support it. 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 :|

From: "Daniel P. Berrange" <berrange@redhat.com> Always enable driver modules for libvirtd, if we have dlopen available. This allows more modular packaging by distros and ensures we don't break this config * configure.ac: Default to enable driver modules Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- configure.ac | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 741a339..5d06b47 100644 --- a/configure.ac +++ b/configure.ac @@ -2422,14 +2422,27 @@ dnl Driver-Modules library AC_ARG_WITH([driver-modules], AC_HELP_STRING([--with-driver-modules], [build drivers as loadable modules @<:@default=no@:>@]), [], - [with_driver_modules=no]) + [with_driver_modules=check]) + +if test "$with_libvirtd" = "no" ; then + with_driver_modules=no +fi DRIVER_MODULE_CFLAGS= DRIVER_MODULE_LIBS= -if test "$with_driver_modules" = "yes"; then +if test "$with_driver_modules" = "yes" || test "$with_driver_modules" = "check"; then if test "$dlfcn_found" != "yes" || test "$dlopen_found" != "yes"; then - AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules]) + if test "$with_driver_modules" = "yes" ; then + AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules]) + else + with_driver_modules=no + fi + else + with_driver_modules=yes fi +fi + +if test "$with_driver_modules" = "yes" ; then DRIVER_MODULE_CFLAGS="-export-dynamic" case $ac_cv_search_dlopen in no*) DRIVER_MODULE_LIBS= ;; -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Always enable driver modules for libvirtd, if we have dlopen available. This allows more modular packaging by distros and ensures we don't break this config
* configure.ac: Default to enable driver modules
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- configure.ac | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Turn on loadable modules for libvirtd. Add new sub-RPMs libvirt-daemon-driver-XXX, one for each loadable .so. Modify the libvirt-daemon-YYY RPMs to depend on each of the individual drivers they required * libvirt.spec.in: Enable driver modules Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt.spec.in | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 293 insertions(+), 3 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 0a6872e..ff5a892 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -34,6 +34,8 @@ %define server_drivers 1 %endif +# Always build with dlopen'd modules +%define with_driver_modules 1 # Now set the defaults for all the important features, independent # of any particular OS @@ -256,6 +258,25 @@ %endif %endif +%if %{with_udev} || %{with_hal} +%define with_nodedev 1 +%else +%define with_nodedev 0 +%endif + +%if %{with_netcf} +%define with_interface 1 +%else +%define with_interface 0 +%endif + +%if %{with_storage_fs} || %{with_storage_mpath} || %{with_storage_iscsi} || %{with_storage_lvm} || %{with_storage_disk} +%define with_storage 1 +%else +%define with_storage 0 +%endif + + # Force QEMU to run as non-root %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 %define qemu_user qemu @@ -616,9 +637,152 @@ Requires: libvirt-daemon = %{version}-%{release} Network filter configuration files for cleaning guest traffic %endif -# XXX when we turn on driver modules, we will need to -# create daemon-drv-XXX sub-RPMs and add them as deps -# to all of the following daemon-XXX RPMs +%if %{with_driver_modules} +%if %{with_network} +%package daemon-driver-network +Summary: Network driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-network +The network driver plugin for the libvirtd daemon, providing +an implementation of the virtual network APIs using the Linux +bridge capabilities. +%endif + + +%if %{with_nwfilter} +%package daemon-driver-nwfilter +Summary: Nwfilter driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-nwfilter +The nwfilter driver plugin for the libvirtd daemon, providing +an implementation of the firewall APIs using the ebtables, +iptables and ip6tables capabilities +%endif + + +%if %{with_nodedev} +%package daemon-driver-nodedev +Summary: Nodedev driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-nodedev +The nodedev driver plugin for the libvirtd daemon, providing +an implementation of the node device APIs using the udev +capabilities. +%endif + + +%if %{with_interface} +%package daemon-driver-interface +Summary: Interface driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-interface +The interface driver plugin for the libvirtd daemon, providing +an implementation of the network interface APIs using the +netcf library +%endif + + +%package daemon-driver-secret +Summary: Secret driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-secret +The secret driver plugin for the libvirtd daemon, providing +an implementation of the secret key APIs. + + +%if %{with_storage} +%package daemon-driver-storage +Summary: Storage driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-storage +The storage driver plugin for the libvirtd daemon, providing +an implementation of the storage APIs using LVM, iSCSI, +parted and more. +%endif + + +%if %{with_qemu} +%package daemon-driver-qemu +Summary: Qemu driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} +# There really is a hard cross-driver dependancy here +Requires: libvirt-daemon-network = %{version}-%{release} + +%description daemon-driver-qemu +The qemu driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +QEMU +%endif + + +%if %{with_lxc} +%package daemon-driver-lxc +Summary: LXC driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} +# There really is a hard cross-driver dependancy here +Requires: libvirt-daemon-network = %{version}-%{release} + +%description daemon-driver-lxc +The LXC driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +the Linux kernel +%endif + + +%if %{with_uml} +%package daemon-driver-uml +Summary: Uml driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-uml +The UML driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +User Mode Linux +%endif + + +%if %{with_xen} +%package daemon-driver-xen +Summary: Xen driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-xen +The Xen driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +Xen +%endif + + +%if %{with_libxl} +%package daemon-driver-libxl +Summary: Libxl driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} + +%description daemon-driver-libxl +The Libxl driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +Libxl +%endif +%endif + + %if %{with_qemu_tcg} %package daemon-qemu @@ -626,6 +790,15 @@ Summary: Server side daemon & driver required to run QEMU guests Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +Requires: libvirt-daemon-driver-qemu = %{version}-%{release} +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif Requires: qemu %description daemon-qemu @@ -640,6 +813,15 @@ Summary: Server side daemon & driver required to run KVM guests Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +Requires: libvirt-daemon-driver-qemu = %{version}-%{release} +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif Requires: qemu-kvm %description daemon-kvm @@ -654,6 +836,15 @@ Summary: Server side daemon & driver required to run LXC guests Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +Requires: libvirt-daemon-driver-lxc = %{version}-%{release} +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif %description daemon-lxc Server side daemon and driver required to manage the virtualization @@ -667,6 +858,15 @@ Summary: Server side daemon & driver required to run UML guests Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +Requires: libvirt-daemon-driver-uml = %{version}-%{release} +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif # There are no UML kernel RPMs in Fedora/RHEL to depend on. %description daemon-uml @@ -681,6 +881,20 @@ Summary: Server side daemon & driver required to run XEN guests Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +%if %{with_xen} +Requires: libvirt-daemon-driver-xen = %{version}-%{release} +%endif +%if %{with_libxl} +Requires: libvirt-daemon-driver-libxl = %{version}-%{release} +%endif +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif Requires: xen %description daemon-xen @@ -907,6 +1121,10 @@ of recent versions of Linux (and other OSes). %define _without_dtrace --without-dtrace %endif +%if ! %{with_driver_modules} +%define _without_driver_modules --without-driver-modules +%endif + %define when %(date +"%%F-%%T") %define where %(hostname) %define who %{?packager}%{!?packager:Unknown} @@ -962,6 +1180,7 @@ autoreconf -if %{?_without_macvtap} \ %{?_without_audit} \ %{?_without_dtrace} \ + %{?_without_driver_modules} \ %{with_packager} \ %{with_packager_version} \ --with-qemu-user=%{qemu_user} \ @@ -984,6 +1203,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/*.a rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.a +%if %{with_driver_modules} +rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a +%endif %if %{with_network} install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/ @@ -1343,6 +1566,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %{_mandir}/man8/libvirtd.8* +%if %{with_driver_modules} %if %{with_network} %files daemon-config-network %defattr(-, root, root) @@ -1354,6 +1578,71 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %{_sysconfdir}/libvirt/nwfilter/*.xml %endif +%if %{with_interface} +%files daemon-driver-interface +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so +%endif + +%if %{with_network} +%files daemon-driver-network +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_network.so +%endif + +%if %{with_nodedev} +%files daemon-driver-nodedev +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_nodedev.so +%endif + +%if %{with_nwfilter} +%files daemon-driver-nwfilter +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_nwfilter.so +%endif + +%files daemon-driver-secret +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_secret.so + +%if %{with_storage} +%files daemon-driver-storage +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so +%endif + +%if %{with_qemu} +%files daemon-driver-qemu +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so +%endif + +%if %{with_lxc} +%files daemon-driver-lxc +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so +%endif + +%if %{with_uml} +%files daemon-driver-uml +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so +%endif + +%if %{with_xen} +%files daemon-driver-xen +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so +%endif + +%if %{with_libxl} +%files daemon-driver-libxl +%defattr(-, root, root) +%{_libdir}/%{name}/connection-driver/libvirt_driver_libxl.so +%endif +%endif + %if %{with_qemu_tcg} %files daemon-qemu %defattr(-, root, root) @@ -1411,6 +1700,7 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd %if %{with_dtrace} %{_datadir}/systemtap/tapset/libvirt_probes.stp +%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp %{_datadir}/systemtap/tapset/libvirt_functions.stp %endif -- 1.7.7.6

On 05/21/2012 01:59 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Turn on loadable modules for libvirtd. Add new sub-RPMs libvirt-daemon-driver-XXX, one for each loadable .so. Modify the libvirt-daemon-YYY RPMs to depend on each of the individual drivers they required
* libvirt.spec.in: Enable driver modules
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt.spec.in | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 293 insertions(+), 3 deletions(-)
+ +%if %{with_qemu} +%package daemon-driver-qemu +Summary: Qemu driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} +# There really is a hard cross-driver dependancy here
s/dependancy/dependency/ (multiple places) ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

At 05/22/2012 03:59 AM, Daniel P. Berrange Wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Turn on loadable modules for libvirtd. Add new sub-RPMs libvirt-daemon-driver-XXX, one for each loadable .so. Modify the libvirt-daemon-YYY RPMs to depend on each of the individual drivers they required
I build the libvirt and try to install it, and meet some dependencies error: error: Failed dependencies: libvirt-daemon-network = 0.9.12-1.el6 is needed by libvirt-daemon-driver-lxc-0.9.12-1.el6.x86_64 libvirt-daemon-network = 0.9.12-1.el6 is needed by libvirt-daemon-driver-qemu-0.9.12-1.el6.x86_64 libvirt-daemon-driver-nwilter = 0.9.12-1.el6 is needed by libvirt-daemon-kvm-0.9.12-1.el6.x86_64 libvirt-daemon-driver-nwilter = 0.9.12-1.el6 is needed by libvirt-daemon-lxc-0.9.12-1.el6.x86_64
* libvirt.spec.in: Enable driver modules
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- libvirt.spec.in | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 293 insertions(+), 3 deletions(-)
<cut>
+%if %{with_qemu} +%package daemon-driver-qemu +Summary: Qemu driver plugin for the libvirtd daemon +Group: Development/Libraries +Requires: libvirt-daemon = %{version}-%{release} +# There really is a hard cross-driver dependancy here +Requires: libvirt-daemon-network = %{version}-%{release}
I donot find anything about libvirt-daemon-network.
+ +%description daemon-driver-qemu +The qemu driver plugin for the libvirtd daemon, providing +an implementation of the hypervisor driver APIs using +QEMU +%endif
<cut>
%if %{with_qemu_tcg} %package daemon-qemu @@ -626,6 +790,15 @@ Summary: Server side daemon & driver required to run QEMU guests Group: Development/Libraries
Requires: libvirt-daemon = %{version}-%{release} +%if %{with_driver_modules} +Requires: libvirt-daemon-driver-qemu = %{version}-%{release} +Requires: libvirt-daemon-driver-interface = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} +Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} +Requires: libvirt-daemon-driver-nwilter = %{version}-%{release}
I donot find anything about libvirt-daemon-driver-nwilter in spec file. Thanks Wen Congyang
+Requires: libvirt-daemon-driver-secret = %{version}-%{release} +Requires: libvirt-daemon-driver-storage = %{version}-%{release} +%endif Requires: qemu

From: "Daniel P. Berrange" <berrange@redhat.com> s/daemon-driver-nwilter/daemon-driver/nwfilter/ s/daemon-network/daemon-driver-network/ --- libvirt.spec.in | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 0669073..d4e43f6 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -721,7 +721,7 @@ Summary: Qemu driver plugin for the libvirtd daemon Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here -Requires: libvirt-daemon-network = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} %description daemon-driver-qemu The qemu driver plugin for the libvirtd daemon, providing @@ -736,7 +736,7 @@ Summary: LXC driver plugin for the libvirtd daemon Group: Development/Libraries Requires: libvirt-daemon = %{version}-%{release} # There really is a hard cross-driver dependency here -Requires: libvirt-daemon-network = %{version}-%{release} +Requires: libvirt-daemon-driver-network = %{version}-%{release} %description daemon-driver-lxc The LXC driver plugin for the libvirtd daemon, providing @@ -797,7 +797,7 @@ Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} -Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} %endif @@ -820,7 +820,7 @@ Requires: libvirt-daemon-driver-qemu = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} -Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} %endif @@ -843,7 +843,7 @@ Requires: libvirt-daemon-driver-lxc = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} -Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} %endif @@ -865,7 +865,7 @@ Requires: libvirt-daemon-driver-uml = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} -Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} %endif @@ -893,7 +893,7 @@ Requires: libvirt-daemon-driver-libxl = %{version}-%{release} Requires: libvirt-daemon-driver-interface = %{version}-%{release} Requires: libvirt-daemon-driver-network = %{version}-%{release} Requires: libvirt-daemon-driver-nodedev = %{version}-%{release} -Requires: libvirt-daemon-driver-nwilter = %{version}-%{release} +Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release} Requires: libvirt-daemon-driver-secret = %{version}-%{release} Requires: libvirt-daemon-driver-storage = %{version}-%{release} %endif -- 1.7.7.6

On 05/25/2012 01:12 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
s/daemon-driver-nwilter/daemon-driver/nwfilter/
Typo in your substitution line of your commit message (s//// is not a valid substitution command).
s/daemon-network/daemon-driver-network/ --- libvirt.spec.in | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, May 21, 2012 at 08:59:08PM +0100, Daniel P. Berrange wrote:
A simple rebase of
https://www.redhat.com/archives/libvir-list/2012-April/msg00045.html
For a long timer we've had the ability to build each libvirt driver as a loadable module. We have never used this by default and as a result it constantly bit-rots.
This series fixes various bugs, and then enables it by default in configure. It also makes the PRMs use the loadable modules, adding new new sub-RPMs for each module. We can now finally install minimal libvirt binaries for each hypervisor.
ie yum install libvirt-daemon-kvm
will not pull in Xen libraries!
Changes in v2:
- Fix build with dtrace - Rebase to latest GIT master
ACK on the general idea, I see Eric reviewed the patches already. I would suggest we add a note (mainly in docs/drivers.html.in and possibly in docs/internals.html.in) stating that the APIs used by the drivers are internal and not part of the ABI guarantees even if they are distributed as separate shared library. Historically we had punted on enabling shared libraries to avoid proprietary drivers, now the daemon runs as GPL by the virtue of linking with GPL libraries so that may discourage such behaviour but we should at least make clear that we won't make shipping out of source drivers an easy task :) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Thu, May 24, 2012 at 02:41:02PM +0800, Daniel Veillard wrote:
On Mon, May 21, 2012 at 08:59:08PM +0100, Daniel P. Berrange wrote:
A simple rebase of
https://www.redhat.com/archives/libvir-list/2012-April/msg00045.html
For a long timer we've had the ability to build each libvirt driver as a loadable module. We have never used this by default and as a result it constantly bit-rots.
This series fixes various bugs, and then enables it by default in configure. It also makes the PRMs use the loadable modules, adding new new sub-RPMs for each module. We can now finally install minimal libvirt binaries for each hypervisor.
ie yum install libvirt-daemon-kvm
will not pull in Xen libraries!
Changes in v2:
- Fix build with dtrace - Rebase to latest GIT master
ACK on the general idea, I see Eric reviewed the patches already. I would suggest we add a note (mainly in docs/drivers.html.in and possibly in docs/internals.html.in) stating that the APIs used by the drivers are internal and not part of the ABI guarantees even if they are distributed as separate shared library. Historically we had punted on enabling shared libraries to avoid proprietary drivers, now the daemon runs as GPL by the virtue of linking with GPL libraries so that may discourage such behaviour but we should at least make clear that we won't make shipping out of source drivers an easy task :)
Ok, I'll add some docs about this. 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 (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake
-
Wen Congyang