[libvirt] [PATCH RFC 1/2] make: Drop building without driver modules

Peter Krempa posted 2 patches 7 years, 9 months ago
[libvirt] [PATCH RFC 1/2] make: Drop building without driver modules
Posted by Peter Krempa 7 years, 9 months ago
Driver modules proved to be reliable for a long time. Since support for
not building modules complicates the code and makefiles drop the support
for not building drivers as modules.
---

Notes:
    This was suggested a while ago by Dan:
    
    https://www.redhat.com/archives/libvir-list/2017-March/msg00917.html
    
    I actually did not try to build this on windows, since I don't have the
    environment ready (do we actually even build the daemon on windows?).
    
    It simplifies the next patch so I thought it may be the right time to do this.

 daemon/Makefile.am            |  57 ---------------
 daemon/libvirtd.c             |  54 +--------------
 m4/virt-driver-modules.m4     |  24 +++----
 src/Makefile.am               | 158 ------------------------------------------
 src/driver.c                  |   8 +--
 src/storage/storage_backend.c |  11 +--
 src/vbox/vbox_driver.c        |   2 +-
 src/vbox/vbox_driver.h        |   6 +-
 tests/Makefile.am             |   6 --
 tests/testutils.c             |   2 -
 tools/virsh.c                 |   3 -
 11 files changed, 21 insertions(+), 310 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index d02ab33bd..697778e56 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -208,63 +208,6 @@ libvirtd_LDADD += \
 	../src/libvirt_driver_remote.la \
 	$(NULL)

-if ! WITH_DRIVER_MODULES
-if WITH_QEMU
-    libvirtd_LDADD += ../src/libvirt_driver_qemu.la
-if WITH_DTRACE_PROBES
-    libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
-endif WITH_DTRACE_PROBES
-endif WITH_QEMU
-
-if WITH_LXC
-    libvirtd_LDADD += ../src/libvirt_driver_lxc.la
-endif WITH_LXC
-
-if WITH_XEN
-    libvirtd_LDADD += ../src/libvirt_driver_xen.la
-endif WITH_XEN
-
-if WITH_LIBXL
-    libvirtd_LDADD += ../src/libvirt_driver_libxl.la
-endif WITH_LIBXL
-
-if WITH_UML
-    libvirtd_LDADD += ../src/libvirt_driver_uml.la
-endif WITH_UML
-
-if WITH_VBOX
-    libvirtd_LDADD += ../src/libvirt_driver_vbox.la
-endif WITH_VBOX
-
-if WITH_VZ
-    libvirtd_LDADD += ../src/libvirt_driver_vz.la
-endif WITH_VZ
-
-if WITH_STORAGE
-    libvirtd_LDADD += ../src/libvirt_driver_storage.la
-endif WITH_STORAGE
-
-if WITH_NETWORK
-    libvirtd_LDADD += ../src/libvirt_driver_network.la
-endif WITH_NETWORK
-
-if WITH_INTERFACE
-    libvirtd_LDADD += ../src/libvirt_driver_interface.la
-endif WITH_INTERFACE
-
-if WITH_NODE_DEVICES
-    libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
-endif WITH_NODE_DEVICES
-
-if WITH_SECRETS
-    libvirtd_LDADD += ../src/libvirt_driver_secret.la
-endif WITH_SECRETS
-
-if WITH_NWFILTER
-    libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
-endif WITH_NWFILTER
-endif ! WITH_DRIVER_MODULES
-
 libvirtd_LDADD += ../src/libvirt.la

 if WITH_POLKIT
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index a55845873..7e5d7af69 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -60,52 +60,7 @@
 #include "virgettext.h"
 #include "util/virnetdevopenvswitch.h"

-#ifdef WITH_DRIVER_MODULES
-# include "driver.h"
-#else
-# ifdef WITH_QEMU
-#  include "qemu/qemu_driver.h"
-# endif
-# ifdef WITH_LXC
-#  include "lxc/lxc_driver.h"
-# endif
-# ifdef WITH_XEN
-#  include "xen/xen_driver.h"
-# endif
-# ifdef WITH_LIBXL
-#  include "libxl/libxl_driver.h"
-# endif
-# ifdef WITH_UML
-#  include "uml/uml_driver.h"
-# endif
-# ifdef WITH_VBOX
-#  include "vbox/vbox_driver.h"
-# endif
-# ifdef WITH_BHYVE
-#  include "bhyve/bhyve_driver.h"
-# endif
-# ifdef WITH_NETWORK
-#  include "network/bridge_driver.h"
-# endif
-# ifdef WITH_INTERFACE
-#  include "interface/interface_driver.h"
-# endif
-# ifdef WITH_STORAGE
-#  include "storage/storage_driver.h"
-# endif
-# ifdef WITH_NODE_DEVICES
-#  include "node_device/node_device_driver.h"
-# endif
-# ifdef WITH_SECRETS
-#  include "secret/secret_driver.h"
-# endif
-# ifdef WITH_NWFILTER
-#  include "nwfilter/nwfilter_driver.h"
-# endif
-#endif
-#ifdef WITH_VZ
-# include "vz/vz_driver.h"
-#endif
+#include "driver.h"

 #include "configmake.h"

@@ -341,13 +296,8 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
 }


-#ifdef WITH_DRIVER_MODULES
-# define VIR_DAEMON_LOAD_MODULE(func, module) \
+#define VIR_DAEMON_LOAD_MODULE(func, module) \
     virDriverLoadModule(module, #func)
-#else
-# define VIR_DAEMON_LOAD_MODULE(func, module) \
-    func()
-#endif
 static void daemonInitialize(void)
 {
     /*
diff --git a/m4/virt-driver-modules.m4 b/m4/virt-driver-modules.m4
index ba65c3ba6..8bf8ecf2b 100644
--- a/m4/virt-driver-modules.m4
+++ b/m4/virt-driver-modules.m4
@@ -19,7 +19,7 @@ dnl

 AC_DEFUN([LIBVIRT_ARG_DRIVER_MODULES], [
   LIBVIRT_ARG_WITH([DRIVER_MODULES], [build drivers as loadable modules],
-                   [check])
+                   [yes])
 ])

 AC_DEFUN([LIBVIRT_CHECK_DRIVER_MODULES], [
@@ -27,28 +27,26 @@ AC_DEFUN([LIBVIRT_CHECK_DRIVER_MODULES], [

   if test "$with_libvirtd" = "no" ; then
     with_driver_modules=no
+  else
+    if test "$with_driver_modules" = "no"; then
+      AC_MSG_ERROR([Building without driver modules is not supported anymore])
+    fi
+
+    if test "$with_driver_modules" = "check"; then
+      with_driver_modules=yes
+    fi
   fi

   DRIVER_MODULES_CFLAGS=
   DRIVER_MODULES_LIBS=
-  if test "$with_driver_modules" = "yes" || test "$with_driver_modules" = "check"; then
+  if test "$with_driver_modules" = "yes"; then
     if test "$with_dlfcn" != "yes" || test "$with_dlopen" != "yes"; then
-      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
+      AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules])
     fi
-  fi

-  if test "$with_driver_modules" = "yes" ; then
     DRIVER_MODULES_LDFLAGS="-export-dynamic"
     DRIVER_MODULES_LIBS="$DLOPEN_LIBS"
-    AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
   fi
-  AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
   AC_SUBST([DRIVER_MODULES_LDFLAGS])
   AC_SUBST([DRIVER_MODULES_LIBS])
 ])
diff --git a/src/Makefile.am b/src/Makefile.am
index d86b28251..471be40d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1328,15 +1328,9 @@ if WITH_XEN
 noinst_LTLIBRARIES += libvirt_driver_xen_impl.la
 libvirt_driver_xen_la_SOURCES =
 libvirt_driver_xen_la_LIBADD = libvirt_driver_xen_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_xen.la
 libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_xen_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_xen.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_xen_impl_la_CFLAGS =				\
 		$(XEN_CFLAGS)					\
@@ -1379,17 +1373,10 @@ noinst_LTLIBRARIES += \
 		libvirt_driver_vbox_impl.la
 libvirt_driver_vbox_la_SOURCES =
 libvirt_driver_vbox_la_LIBADD = libvirt_driver_vbox_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += \
 		libvirt_driver_vbox.la
 libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_vbox.la
-# GPLv2-only license requries that it be linked into
-# libvirtd and *not* libvirt.so
-#libvirt_la_BUILT_LIBADD += libvirt_driver_vbox.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_vbox_impl_la_CFLAGS =				\
 		-I$(srcdir)/conf				\
@@ -1416,15 +1403,9 @@ if WITH_LIBXL
 noinst_LTLIBRARIES += libvirt_driver_libxl_impl.la
 libvirt_driver_libxl_la_SOURCES =
 libvirt_driver_libxl_la_LIBADD = libvirt_driver_libxl_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_libxl.la
 libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_libxl.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_libxl.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_libxl_impl_la_CFLAGS = 		\
 		$(LIBXL_CFLAGS)			\
@@ -1452,15 +1433,9 @@ if WITH_QEMU
 noinst_LTLIBRARIES += libvirt_driver_qemu_impl.la
 libvirt_driver_qemu_la_SOURCES =
 libvirt_driver_qemu_la_LIBADD = libvirt_driver_qemu_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_qemu.la
 libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_qemu.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_qemu_impl_la_CFLAGS = \
 		$(GNUTLS_CFLAGS) \
@@ -1494,15 +1469,9 @@ if WITH_LXC
 noinst_LTLIBRARIES += libvirt_driver_lxc_impl.la
 libvirt_driver_lxc_la_SOURCES =
 libvirt_driver_lxc_la_LIBADD = libvirt_driver_lxc_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_lxc.la
 libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_lxc.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_lxc_impl_la_CFLAGS = \
 		$(LIBNL_CFLAGS) \
@@ -1537,15 +1506,9 @@ if WITH_UML
 noinst_LTLIBRARIES += libvirt_driver_uml_impl.la
 libvirt_driver_uml_la_SOURCES =
 libvirt_driver_uml_la_LIBADD = libvirt_driver_uml_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_uml.la
 libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_uml_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_uml.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_uml.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_uml_impl_la_CFLAGS = \
 		-I$(srcdir)/access \
@@ -1615,13 +1578,9 @@ if WITH_VZ
 noinst_LTLIBRARIES += libvirt_driver_vz_impl.la
 libvirt_driver_vz_la_SOURCES =
 libvirt_driver_vz_la_LIBADD = libvirt_driver_vz_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_vz.la
 libvirt_driver_vz_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_vz_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_vz.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_vz_impl_la_CFLAGS = \
 		-I$(srcdir)/conf \
 		-I$(srcdir)/access \
@@ -1635,13 +1594,9 @@ if WITH_BHYVE
 noinst_LTLIBRARIES += libvirt_driver_bhyve_impl.la
 libvirt_driver_bhyve_la_SOURCES =
 libvirt_driver_bhyve_la_LIBADD = libvirt_driver_bhyve_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_bhyve.la
 libvirt_driver_bhyve_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_bhyve_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_bhyve.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_bhyve_impl_la_CFLAGS = \
 	-I$(srcdir)/access \
@@ -1662,18 +1617,12 @@ if WITH_NETWORK
 noinst_LTLIBRARIES += libvirt_driver_network_impl.la
 libvirt_driver_network_la_SOURCES =
 libvirt_driver_network_la_LIBADD = libvirt_driver_network_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_network.la
 libvirt_driver_network_la_LIBADD += ../gnulib/lib/libgnu.la \
 	$(LIBNL_LIBS) \
 	$(DBUS_LIBS) \
 	$(NULL)
 libvirt_driver_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_network.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_network.la
-endif ! WITH_DRIVER_MODULES

 libvirt_driver_network_impl_la_CFLAGS = \
 		$(LIBNL_CFLAGS) \
@@ -1688,13 +1637,7 @@ EXTRA_DIST += network/default.xml


 if WITH_INTERFACE
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_interface.la
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_interface.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_interface.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_interface_la_CFLAGS = \
 		-I$(srcdir)/access \
 		-I$(srcdir)/conf \
@@ -1709,29 +1652,19 @@ if WITH_UDEV
 libvirt_driver_interface_la_CFLAGS += $(UDEV_CFLAGS)
 libvirt_driver_interface_la_LIBADD += $(UDEV_LIBS)
 endif WITH_UDEV
-if WITH_DRIVER_MODULES
 libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_interface_la_LDFLAGS += -module -avoid-version
-endif WITH_DRIVER_MODULES
 libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES)
 endif WITH_INTERFACE

 if WITH_SECRETS
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_secret.la
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_secret.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_secret.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_secret_la_CFLAGS = \
 		-I$(srcdir)/access \
 		-I$(srcdir)/conf \
 		$(AM_CFLAGS)
-if WITH_DRIVER_MODULES
 libvirt_driver_secret_la_LIBADD = ../gnulib/lib/libgnu.la
 libvirt_driver_secret_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-endif WITH_DRIVER_MODULES
 libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES)
 endif WITH_SECRETS

@@ -1750,24 +1683,16 @@ libvirt_driver_storage_impl_la_CFLAGS += $(BLKID_CFLAGS)
 libvirt_driver_storage_impl_la_LIBADD += $(BLKID_LIBS)
 endif WITH_BLKID

-if WITH_DRIVER_MODULES
 storagebackenddir = $(libdir)/libvirt/storage-backend
 storagebackend_LTLIBRARIES =
-endif WITH_DRIVER_MODULES

 if WITH_STORAGE
 noinst_LTLIBRARIES += libvirt_driver_storage_impl.la
 libvirt_driver_storage_la_SOURCES =
 libvirt_driver_storage_la_LIBADD = libvirt_driver_storage_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_storage.la
 libvirt_driver_storage_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_storage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_storage.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_storage.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_SOURCES)


@@ -1776,14 +1701,9 @@ libvirt_storage_backend_fs_la_CFLAGS =	\
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_fs.la
 libvirt_storage_backend_fs_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_fs.la
-libvirt_driver_storage_impl_la_LIBADD += libvirt_storage_backend_fs.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE

 if WITH_STORAGE_LVM
@@ -1793,15 +1713,9 @@ libvirt_storage_backend_logical_la_CFLAGS = \
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_logical.la
 libvirt_storage_backend_logical_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_logical.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_logical.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_LVM

 if WITH_STORAGE_ISCSI
@@ -1812,15 +1726,9 @@ libvirt_storage_backend_iscsi_la_CFLAGS = \
 	-I$(srcdir)/secret \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_iscsi.la
 libvirt_storage_backend_iscsi_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_iscsi.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_iscsi.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_ISCSI

 if WITH_STORAGE_SCSI
@@ -1829,14 +1737,9 @@ libvirt_storage_backend_scsi_la_CFLAGS = \
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_scsi.la
 libvirt_storage_backend_scsi_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_scsi.la
-libvirt_driver_storage_impl_la_LIBADD += libvirt_storage_backend_scsi.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_SCSI

 if WITH_STORAGE_MPATH
@@ -1848,15 +1751,9 @@ libvirt_storage_backend_mpath_la_CFLAGS =	\
 	$(DEVMAPPER_CFLAGS) \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_mpath.la
 libvirt_storage_backend_mpath_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_mpath.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_mpath.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_MPATH

 if WITH_STORAGE_DISK
@@ -1865,14 +1762,9 @@ libvirt_storage_backend_disk_la_CFLAGS =	\
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_disk.la
 libvirt_storage_backend_disk_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_disk.la
-libvirt_driver_storage_impl_la_LIBADD += libvirt_storage_backend_disk.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_DISK

 if WITH_STORAGE_RBD
@@ -1883,14 +1775,9 @@ libvirt_storage_backend_rbd_la_CFLAGS = \
 	-I$(srcdir)/secret \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_rbd.la
 libvirt_storage_backend_rbd_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_rbd.la
-libvirt_driver_storage_impl_la_LIBADD += libvirt_storage_backend_rbd.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_RBD

 if WITH_STORAGE_SHEEPDOG
@@ -1908,15 +1795,9 @@ libvirt_storage_backend_sheepdog_priv_la_CFLAGS = \
 	$(AM_CFLAGS)
 noinst_LTLIBRARIES += libvirt_storage_backend_sheepdog_priv.la

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_sheepdog.la
 libvirt_storage_backend_sheepdog_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_sheepdog.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_sheepdog.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_SHEEPDOG

 if WITH_STORAGE_GLUSTER
@@ -1928,15 +1809,9 @@ libvirt_storage_backend_gluster_la_CFLAGS = \
 	$(GLUSTERFS_CFLAGS) \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_gluster.la
 libvirt_storage_backend_gluster_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_gluster.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_gluster.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_GLUSTER

 if WITH_STORAGE_ZFS
@@ -1945,14 +1820,9 @@ libvirt_storage_backend_zfs_la_CFLAGS =	\
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_zfs.la
 libvirt_storage_backend_zfs_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_zfs.la
-libvirt_driver_storage_impl_la_LIBADD += libvirt_storage_backend_zfs.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_ZFS

 if WITH_STORAGE_VSTORAGE
@@ -1962,26 +1832,14 @@ libvirt_storage_backend_vstorage_la_CFLAGS =	\
 	-I$(srcdir)/conf \
 	$(AM_CFLAGS)

-if WITH_DRIVER_MODULES
 storagebackend_LTLIBRARIES += libvirt_storage_backend_vstorage.la
 libvirt_storage_backend_vstorage_la_LDFLAGS = \
 	-module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_storage_backend_vstorage.la
-libvirt_driver_storage_impl_la_LIBADD += \
-	libvirt_storage_backend_vstorage.la
-endif ! WITH_DRIVER_MODULES
 endif WITH_STORAGE_VSTORAGE

 if WITH_NODE_DEVICES
 # Needed to keep automake quiet about conditionals
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_nodedev.la
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_nodedev.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_nodedev.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_nodedev_la_SOURCES = $(NODE_DEVICE_DRIVER_SOURCES)

 libvirt_driver_nodedev_la_CFLAGS = \
@@ -2004,10 +1862,8 @@ libvirt_driver_nodedev_la_LIBADD += $(UDEV_LIBS) $(PCIACCESS_LIBS)
 endif WITH_UDEV
 endif WITH_LIBVIRTD

-if WITH_DRIVER_MODULES
 libvirt_driver_nodedev_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_nodedev_la_LDFLAGS += -module -avoid-version
-endif WITH_DRIVER_MODULES
 endif WITH_NODE_DEVICES


@@ -2015,14 +1871,8 @@ if WITH_NWFILTER
 noinst_LTLIBRARIES += libvirt_driver_nwfilter_impl.la
 libvirt_driver_nwfilter_la_SOURCES =
 libvirt_driver_nwfilter_la_LIBADD = libvirt_driver_nwfilter_impl.la
-if WITH_DRIVER_MODULES
 mod_LTLIBRARIES += libvirt_driver_nwfilter.la
 libvirt_driver_nwfilter_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
-else ! WITH_DRIVER_MODULES
-noinst_LTLIBRARIES += libvirt_driver_nwfilter.la
-# Stateful, so linked to daemon instead
-#libvirt_la_BUILT_LIBADD += libvirt_driver_nwfilter.la
-endif ! WITH_DRIVER_MODULES
 libvirt_driver_nwfilter_impl_la_CFLAGS = \
 		$(LIBPCAP_CFLAGS) \
 		$(LIBNL_CFLAGS) \
@@ -2035,10 +1885,8 @@ libvirt_driver_nwfilter_impl_la_LIBADD = \
 		$(LIBPCAP_LIBS) \
 		$(LIBNL_LIBS) \
 		$(DBUS_LIBS)
-if WITH_DRIVER_MODULES
 libvirt_driver_nwfilter_impl_la_LIBADD += ../gnulib/lib/libgnu.la
 libvirt_driver_nwfilter_impl_la_LDFLAGS += -module -avoid-version
-endif WITH_DRIVER_MODULES
 libvirt_driver_nwfilter_impl_la_SOURCES = $(NWFILTER_DRIVER_SOURCES)
 endif WITH_NWFILTER

@@ -2335,11 +2183,7 @@ check-augeas-virtlogd: test_virtlogd.aug
 # symbols aren't present at all.
 #

-if WITH_DRIVER_MODULES
 USED_SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
-else ! WITH_DRIVER_MODULES
-SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
-endif ! WITH_DRIVER_MODULES

 if WITH_LINUX
 USED_SYM_FILES += $(srcdir)/libvirt_linux.syms
@@ -2542,9 +2386,7 @@ nodist_libvirt_la_SOURCES = libvirt_probes.h
 if WITH_REMOTE
 nodist_libvirt_driver_remote_la_SOURCES = libvirt_probes.h
 endif WITH_REMOTE
-if WITH_DRIVER_MODULES
 DTRACE2SYSTEMTAP_FLAGS = --with-modules
-endif WITH_DRIVER_MODULES

 BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp

diff --git a/src/driver.c b/src/driver.c
index f6acfd669..2e7dd01df 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -33,12 +33,10 @@
 VIR_LOG_INIT("driver");


-#ifdef WITH_DRIVER_MODULES
-
 /* XXX re-implement this for other OS, or use libtools helper lib ? */

-# include <dlfcn.h>
-# define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
+#include <dlfcn.h>
+#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"


 static void *
@@ -155,5 +153,3 @@ virDriverLoadModule(const char *name,


 /* XXX unload modules, but we can't until we can unregister libvirt drivers */
-
-#endif
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index e585a5d6b..cdc8d3d57 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -81,9 +81,7 @@ static size_t virStorageBackendsCount;
 static virStorageFileBackendPtr virStorageFileBackends[VIR_STORAGE_BACKENDS_MAX];
 static size_t virStorageFileBackendsCount;

-#if WITH_DRIVER_MODULES
-
-# define STORAGE_BACKEND_MODULE_DIR LIBDIR "/libvirt/storage-backend"
+#define STORAGE_BACKEND_MODULE_DIR LIBDIR "/libvirt/storage-backend"

 static int
 virStorageDriverLoadBackendModule(const char *name,
@@ -116,14 +114,9 @@ virStorageDriverLoadBackendModule(const char *name,
 }


-# define VIR_STORAGE_BACKEND_REGISTER(func, module)                            \
+#define VIR_STORAGE_BACKEND_REGISTER(func, module)                            \
     if (virStorageDriverLoadBackendModule(module, #func, allbackends) < 0)     \
         return -1
-#else
-# define VIR_STORAGE_BACKEND_REGISTER(func, module)                            \
-    if (func() < 0)                                                            \
-        return -1
-#endif

 int
 virStorageBackendDriversRegister(bool allbackends ATTRIBUTE_UNUSED)
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 147a328bc..c10c0c492 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -48,7 +48,7 @@

 VIR_LOG_INIT("vbox.vbox_driver");

-#if !defined(WITH_DRIVER_MODULES) || defined(VBOX_DRIVER)
+#if defined(VBOX_DRIVER)
 static virDrvOpenStatus dummyConnectOpen(virConnectPtr conn,
                                          virConnectAuthPtr auth ATTRIBUTE_UNUSED,
                                          virConfPtr conf ATTRIBUTE_UNUSED,
diff --git a/src/vbox/vbox_driver.h b/src/vbox/vbox_driver.h
index ccd331a41..bf7db2bf8 100644
--- a/src/vbox/vbox_driver.h
+++ b/src/vbox/vbox_driver.h
@@ -31,15 +31,15 @@

 # include "internal.h"

-# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_NETWORK_DRIVER)
+# if defined(VBOX_NETWORK_DRIVER)
 int vboxNetworkRegister(void);
 # endif

-# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_STORAGE_DRIVER)
+# if defined(VBOX_STORAGE_DRIVER)
 int vboxStorageRegister(void);
 # endif

-# if !defined(WITH_DRIVER_MODULES) || defined(VBOX_DRIVER)
+# if defined(VBOX_DRIVER)
 int vboxRegister(void);
 # endif

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 11a380163..7061ae82a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,10 +62,8 @@ QEMULIB_LDFLAGS = \
 	-rpath /evil/libtool/hack/to/force/shared/lib/creation \
 	$(MINGW_EXTRA_LDFLAGS)

-if WITH_DRIVER_MODULES
 INCLUDES += \
 	-DTEST_DRIVER_DIR=\"$(top_builddir)/src/.libs\"
-endif WITH_DRIVER_MODULES

 PROBES_O =
 if WITH_DTRACE_PROBES
@@ -262,9 +260,7 @@ endif WITH_QEMU
 endif WITH_ATTR
 endif WITH_SECDRIVER_SELINUX

-if WITH_DRIVER_MODULES
 test_programs += virdrivermoduletest
-endif WITH_DRIVER_MODULES

 # This is a fake SSH we use from virnetsockettest
 ssh_SOURCES = ssh.c
@@ -1394,11 +1390,9 @@ utiltest_SOURCES = \
 	utiltest.c testutils.h testutils.c
 utiltest_LDADD = $(LDADDS)

-if WITH_DRIVER_MODULES
 virdrivermoduletest_SOURCES = \
 	virdrivermoduletest.c testutils.h testutils.c
 virdrivermoduletest_LDADD = $(LDADDS)
-endif WITH_DRIVER_MODULES

 if WITH_LIBVIRTD
 eventtest_SOURCES = \
diff --git a/tests/testutils.c b/tests/testutils.c
index ed01136a0..2fb6685fd 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -358,9 +358,7 @@ void virTestCaptureProgramExecChild(const char *const argv[],
     int stdinfd = -1;
     const char *const env[] = {
         "LANG=C",
-# if WITH_DRIVER_MODULES
         "LIBVIRT_DRIVER_DIR=" TEST_DRIVER_DIR,
-# endif
         NULL
     };

diff --git a/tools/virsh.c b/tools/virsh.c
index 3da953423..94bb7ff6c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -646,9 +646,6 @@ virshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED)
 #if WITH_READLINE
     vshPrint(ctl, " Readline");
 #endif
-#ifdef WITH_DRIVER_MODULES
-    vshPrint(ctl, " Modular");
-#endif
     vshPrint(ctl, "\n");
 }

-- 
2.13.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 1/2] make: Drop building without driver modules
Posted by Daniel P. Berrange 7 years, 9 months ago
On Wed, Jul 26, 2017 at 10:12:13PM +0200, Peter Krempa wrote:
> Driver modules proved to be reliable for a long time. Since support for
> not building modules complicates the code and makefiles drop the support
> for not building drivers as modules.
> ---
> 
> Notes:
>     This was suggested a while ago by Dan:
>     
>     https://www.redhat.com/archives/libvir-list/2017-March/msg00917.html
>     
>     I actually did not try to build this on windows, since I don't have the
>     environment ready (do we actually even build the daemon on windows?).

We don't build the daemon on Win32. If we did ever want todo that, Win32
has an equivalent to dlopen we could use, so modules aren't a blocker for
that.

> daemon/Makefile.am            |  57 ---------------
> daemon/libvirtd.c             |  54 +--------------
> m4/virt-driver-modules.m4     |  24 +++----
> src/Makefile.am               | 158 ------------------------------------------
> src/driver.c                  |   8 +--
> src/storage/storage_backend.c |  11 +--
> src/vbox/vbox_driver.c        |   2 +-
> src/vbox/vbox_driver.h        |   6 +-
> tests/Makefile.am             |   6 --
> tests/testutils.c             |   2 -
> tools/virsh.c                 |   3 -
> 11 files changed, 21 insertions(+), 310 deletions(-)
>

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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