From nobody Fri May 3 02:36:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501099942174910.0935674608526; Wed, 26 Jul 2017 13:12:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B6903F752; Wed, 26 Jul 2017 20:12:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83E986933E; Wed, 26 Jul 2017 20:12:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8F73D14B24; Wed, 26 Jul 2017 20:12:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QKCF1O016762 for ; Wed, 26 Jul 2017 16:12:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72EF560C14; Wed, 26 Jul 2017 20:12:15 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7788F6FDBB; Wed, 26 Jul 2017 20:12:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2B6903F752 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 22:12:13 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH RFC 1/2] make: Drop building without driver modules X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 26 Jul 2017 20:12:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Daniel P. Berrange --- Notes: This was suggested a while ago by Dan: =20 https://www.redhat.com/archives/libvir-list/2017-March/msg00917.html =20 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?). =20 It simplifies the next patch so I thought it may be the right time to d= o 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 +=3D \ ../src/libvirt_driver_remote.la \ $(NULL) -if ! WITH_DRIVER_MODULES -if WITH_QEMU - libvirtd_LDADD +=3D ../src/libvirt_driver_qemu.la -if WITH_DTRACE_PROBES - libvirtd_LDADD +=3D ../src/libvirt_qemu_probes.lo -endif WITH_DTRACE_PROBES -endif WITH_QEMU - -if WITH_LXC - libvirtd_LDADD +=3D ../src/libvirt_driver_lxc.la -endif WITH_LXC - -if WITH_XEN - libvirtd_LDADD +=3D ../src/libvirt_driver_xen.la -endif WITH_XEN - -if WITH_LIBXL - libvirtd_LDADD +=3D ../src/libvirt_driver_libxl.la -endif WITH_LIBXL - -if WITH_UML - libvirtd_LDADD +=3D ../src/libvirt_driver_uml.la -endif WITH_UML - -if WITH_VBOX - libvirtd_LDADD +=3D ../src/libvirt_driver_vbox.la -endif WITH_VBOX - -if WITH_VZ - libvirtd_LDADD +=3D ../src/libvirt_driver_vz.la -endif WITH_VZ - -if WITH_STORAGE - libvirtd_LDADD +=3D ../src/libvirt_driver_storage.la -endif WITH_STORAGE - -if WITH_NETWORK - libvirtd_LDADD +=3D ../src/libvirt_driver_network.la -endif WITH_NETWORK - -if WITH_INTERFACE - libvirtd_LDADD +=3D ../src/libvirt_driver_interface.la -endif WITH_INTERFACE - -if WITH_NODE_DEVICES - libvirtd_LDADD +=3D ../src/libvirt_driver_nodedev.la -endif WITH_NODE_DEVICES - -if WITH_SECRETS - libvirtd_LDADD +=3D ../src/libvirt_driver_secret.la -endif WITH_SECRETS - -if WITH_NWFILTER - libvirtd_LDADD +=3D ../src/libvirt_driver_nwfilter.la -endif WITH_NWFILTER -endif ! WITH_DRIVER_MODULES - libvirtd_LDADD +=3D ../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 p= riority) } -#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" =3D "no" ; then with_driver_modules=3Dno + else + if test "$with_driver_modules" =3D "no"; then + AC_MSG_ERROR([Building without driver modules is not supported anymo= re]) + fi + + if test "$with_driver_modules" =3D "check"; then + with_driver_modules=3Dyes + fi fi DRIVER_MODULES_CFLAGS=3D DRIVER_MODULES_LIBS=3D - if test "$with_driver_modules" =3D "yes" || test "$with_driver_modules" = =3D "check"; then + if test "$with_driver_modules" =3D "yes"; then if test "$with_dlfcn" !=3D "yes" || test "$with_dlopen" !=3D "yes"; th= en - if test "$with_driver_modules" =3D "yes" ; then - AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build dr= iver modules]) - else - with_driver_modules=3Dno - fi - else - with_driver_modules=3Dyes + AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driv= er modules]) fi - fi - if test "$with_driver_modules" =3D "yes" ; then DRIVER_MODULES_LDFLAGS=3D"-export-dynamic" DRIVER_MODULES_LIBS=3D"$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" !=3D = "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 +=3D libvirt_driver_xen_impl.la libvirt_driver_xen_la_SOURCES =3D libvirt_driver_xen_la_LIBADD =3D libvirt_driver_xen_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_xen.la libvirt_driver_xen_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_xen_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_xen.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_xen.la -endif ! WITH_DRIVER_MODULES libvirt_driver_xen_impl_la_CFLAGS =3D \ $(XEN_CFLAGS) \ @@ -1379,17 +1373,10 @@ noinst_LTLIBRARIES +=3D \ libvirt_driver_vbox_impl.la libvirt_driver_vbox_la_SOURCES =3D libvirt_driver_vbox_la_LIBADD =3D libvirt_driver_vbox_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D \ libvirt_driver_vbox.la libvirt_driver_vbox_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_vbox_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_vbox.la -# GPLv2-only license requries that it be linked into -# libvirtd and *not* libvirt.so -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_vbox.la -endif ! WITH_DRIVER_MODULES libvirt_driver_vbox_impl_la_CFLAGS =3D \ -I$(srcdir)/conf \ @@ -1416,15 +1403,9 @@ if WITH_LIBXL noinst_LTLIBRARIES +=3D libvirt_driver_libxl_impl.la libvirt_driver_libxl_la_SOURCES =3D libvirt_driver_libxl_la_LIBADD =3D libvirt_driver_libxl_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_libxl.la libvirt_driver_libxl_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_libxl_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_libxl.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_libxl.la -endif ! WITH_DRIVER_MODULES libvirt_driver_libxl_impl_la_CFLAGS =3D \ $(LIBXL_CFLAGS) \ @@ -1452,15 +1433,9 @@ if WITH_QEMU noinst_LTLIBRARIES +=3D libvirt_driver_qemu_impl.la libvirt_driver_qemu_la_SOURCES =3D libvirt_driver_qemu_la_LIBADD =3D libvirt_driver_qemu_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_qemu.la libvirt_driver_qemu_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_qemu_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_qemu.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_qemu.la -endif ! WITH_DRIVER_MODULES libvirt_driver_qemu_impl_la_CFLAGS =3D \ $(GNUTLS_CFLAGS) \ @@ -1494,15 +1469,9 @@ if WITH_LXC noinst_LTLIBRARIES +=3D libvirt_driver_lxc_impl.la libvirt_driver_lxc_la_SOURCES =3D libvirt_driver_lxc_la_LIBADD =3D libvirt_driver_lxc_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_lxc.la libvirt_driver_lxc_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_lxc_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_lxc.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_lxc.la -endif ! WITH_DRIVER_MODULES libvirt_driver_lxc_impl_la_CFLAGS =3D \ $(LIBNL_CFLAGS) \ @@ -1537,15 +1506,9 @@ if WITH_UML noinst_LTLIBRARIES +=3D libvirt_driver_uml_impl.la libvirt_driver_uml_la_SOURCES =3D libvirt_driver_uml_la_LIBADD =3D libvirt_driver_uml_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_uml.la libvirt_driver_uml_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_uml_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_uml.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_uml.la -endif ! WITH_DRIVER_MODULES libvirt_driver_uml_impl_la_CFLAGS =3D \ -I$(srcdir)/access \ @@ -1615,13 +1578,9 @@ if WITH_VZ noinst_LTLIBRARIES +=3D libvirt_driver_vz_impl.la libvirt_driver_vz_la_SOURCES =3D libvirt_driver_vz_la_LIBADD =3D libvirt_driver_vz_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_vz.la libvirt_driver_vz_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_vz_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_vz.la -endif ! WITH_DRIVER_MODULES libvirt_driver_vz_impl_la_CFLAGS =3D \ -I$(srcdir)/conf \ -I$(srcdir)/access \ @@ -1635,13 +1594,9 @@ if WITH_BHYVE noinst_LTLIBRARIES +=3D libvirt_driver_bhyve_impl.la libvirt_driver_bhyve_la_SOURCES =3D libvirt_driver_bhyve_la_LIBADD =3D libvirt_driver_bhyve_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_bhyve.la libvirt_driver_bhyve_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_bhyve_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_bhyve.la -endif ! WITH_DRIVER_MODULES libvirt_driver_bhyve_impl_la_CFLAGS =3D \ -I$(srcdir)/access \ @@ -1662,18 +1617,12 @@ if WITH_NETWORK noinst_LTLIBRARIES +=3D libvirt_driver_network_impl.la libvirt_driver_network_la_SOURCES =3D libvirt_driver_network_la_LIBADD =3D libvirt_driver_network_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_network.la libvirt_driver_network_la_LIBADD +=3D ../gnulib/lib/libgnu.la \ $(LIBNL_LIBS) \ $(DBUS_LIBS) \ $(NULL) libvirt_driver_network_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_network.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_network.la -endif ! WITH_DRIVER_MODULES libvirt_driver_network_impl_la_CFLAGS =3D \ $(LIBNL_CFLAGS) \ @@ -1688,13 +1637,7 @@ EXTRA_DIST +=3D network/default.xml if WITH_INTERFACE -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_interface.la -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_interface.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_interface.la -endif ! WITH_DRIVER_MODULES libvirt_driver_interface_la_CFLAGS =3D \ -I$(srcdir)/access \ -I$(srcdir)/conf \ @@ -1709,29 +1652,19 @@ if WITH_UDEV libvirt_driver_interface_la_CFLAGS +=3D $(UDEV_CFLAGS) libvirt_driver_interface_la_LIBADD +=3D $(UDEV_LIBS) endif WITH_UDEV -if WITH_DRIVER_MODULES libvirt_driver_interface_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_interface_la_LDFLAGS +=3D -module -avoid-version -endif WITH_DRIVER_MODULES libvirt_driver_interface_la_SOURCES =3D $(INTERFACE_DRIVER_SOURCES) endif WITH_INTERFACE if WITH_SECRETS -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_secret.la -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_secret.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_secret.la -endif ! WITH_DRIVER_MODULES libvirt_driver_secret_la_CFLAGS =3D \ -I$(srcdir)/access \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES libvirt_driver_secret_la_LIBADD =3D ../gnulib/lib/libgnu.la libvirt_driver_secret_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -endif WITH_DRIVER_MODULES libvirt_driver_secret_la_SOURCES =3D $(SECRET_DRIVER_SOURCES) endif WITH_SECRETS @@ -1750,24 +1683,16 @@ libvirt_driver_storage_impl_la_CFLAGS +=3D $(BLKID_= CFLAGS) libvirt_driver_storage_impl_la_LIBADD +=3D $(BLKID_LIBS) endif WITH_BLKID -if WITH_DRIVER_MODULES storagebackenddir =3D $(libdir)/libvirt/storage-backend storagebackend_LTLIBRARIES =3D -endif WITH_DRIVER_MODULES if WITH_STORAGE noinst_LTLIBRARIES +=3D libvirt_driver_storage_impl.la libvirt_driver_storage_la_SOURCES =3D libvirt_driver_storage_la_LIBADD =3D libvirt_driver_storage_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_storage.la libvirt_driver_storage_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_storage_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_storage.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_storage.la -endif ! WITH_DRIVER_MODULES libvirt_driver_storage_impl_la_SOURCES +=3D $(STORAGE_DRIVER_SOURCES) @@ -1776,14 +1701,9 @@ libvirt_storage_backend_fs_la_CFLAGS =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_fs.la libvirt_storage_backend_fs_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_fs.la -libvirt_driver_storage_impl_la_LIBADD +=3D 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 =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_logical.la libvirt_storage_backend_logical_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_logical.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 =3D \ -I$(srcdir)/secret \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_iscsi.la libvirt_storage_backend_iscsi_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_iscsi.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_scsi.la libvirt_storage_backend_scsi_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_scsi.la -libvirt_driver_storage_impl_la_LIBADD +=3D 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 =3D \ $(DEVMAPPER_CFLAGS) \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_mpath.la libvirt_storage_backend_mpath_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_mpath.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_disk.la libvirt_storage_backend_disk_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_disk.la -libvirt_driver_storage_impl_la_LIBADD +=3D 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 =3D \ -I$(srcdir)/secret \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_rbd.la libvirt_storage_backend_rbd_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_rbd.la -libvirt_driver_storage_impl_la_LIBADD +=3D 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 =3D \ $(AM_CFLAGS) noinst_LTLIBRARIES +=3D libvirt_storage_backend_sheepdog_priv.la -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_sheepdog.la libvirt_storage_backend_sheepdog_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_sheepdog.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 =3D \ $(GLUSTERFS_CFLAGS) \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_gluster.la libvirt_storage_backend_gluster_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_gluster.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_zfs.la libvirt_storage_backend_zfs_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_zfs.la -libvirt_driver_storage_impl_la_LIBADD +=3D 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 =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) -if WITH_DRIVER_MODULES storagebackend_LTLIBRARIES +=3D libvirt_storage_backend_vstorage.la libvirt_storage_backend_vstorage_la_LDFLAGS =3D \ -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_storage_backend_vstorage.la -libvirt_driver_storage_impl_la_LIBADD +=3D \ - 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 +=3D libvirt_driver_nodedev.la -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_nodedev.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_nodedev.la -endif ! WITH_DRIVER_MODULES libvirt_driver_nodedev_la_SOURCES =3D $(NODE_DEVICE_DRIVER_SOURCES) libvirt_driver_nodedev_la_CFLAGS =3D \ @@ -2004,10 +1862,8 @@ libvirt_driver_nodedev_la_LIBADD +=3D $(UDEV_LIBS) $= (PCIACCESS_LIBS) endif WITH_UDEV endif WITH_LIBVIRTD -if WITH_DRIVER_MODULES libvirt_driver_nodedev_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_nodedev_la_LDFLAGS +=3D -module -avoid-version -endif WITH_DRIVER_MODULES endif WITH_NODE_DEVICES @@ -2015,14 +1871,8 @@ if WITH_NWFILTER noinst_LTLIBRARIES +=3D libvirt_driver_nwfilter_impl.la libvirt_driver_nwfilter_la_SOURCES =3D libvirt_driver_nwfilter_la_LIBADD =3D libvirt_driver_nwfilter_impl.la -if WITH_DRIVER_MODULES mod_LTLIBRARIES +=3D libvirt_driver_nwfilter.la libvirt_driver_nwfilter_la_LDFLAGS =3D -module -avoid-version $(AM_LDFLAGS) -else ! WITH_DRIVER_MODULES -noinst_LTLIBRARIES +=3D libvirt_driver_nwfilter.la -# Stateful, so linked to daemon instead -#libvirt_la_BUILT_LIBADD +=3D libvirt_driver_nwfilter.la -endif ! WITH_DRIVER_MODULES libvirt_driver_nwfilter_impl_la_CFLAGS =3D \ $(LIBPCAP_CFLAGS) \ $(LIBNL_CFLAGS) \ @@ -2035,10 +1885,8 @@ libvirt_driver_nwfilter_impl_la_LIBADD =3D \ $(LIBPCAP_LIBS) \ $(LIBNL_LIBS) \ $(DBUS_LIBS) -if WITH_DRIVER_MODULES libvirt_driver_nwfilter_impl_la_LIBADD +=3D ../gnulib/lib/libgnu.la libvirt_driver_nwfilter_impl_la_LDFLAGS +=3D -module -avoid-version -endif WITH_DRIVER_MODULES libvirt_driver_nwfilter_impl_la_SOURCES =3D $(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 +=3D $(srcdir)/libvirt_driver_modules.syms -else ! WITH_DRIVER_MODULES -SYM_FILES +=3D $(srcdir)/libvirt_driver_modules.syms -endif ! WITH_DRIVER_MODULES if WITH_LINUX USED_SYM_FILES +=3D $(srcdir)/libvirt_linux.syms @@ -2542,9 +2386,7 @@ nodist_libvirt_la_SOURCES =3D libvirt_probes.h if WITH_REMOTE nodist_libvirt_driver_remote_la_SOURCES =3D libvirt_probes.h endif WITH_REMOTE -if WITH_DRIVER_MODULES DTRACE2SYSTEMTAP_FLAGS =3D --with-modules -endif WITH_DRIVER_MODULES BUILT_SOURCES +=3D libvirt_probes.h libvirt_probes.stp libvirt_functions.s= tp 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 -# define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver" +#include +#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 driver= s */ - -#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_BACKEND= S_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 =3D \ -rpath /evil/libtool/hack/to/force/shared/lib/creation \ $(MINGW_EXTRA_LDFLAGS) -if WITH_DRIVER_MODULES INCLUDES +=3D \ -DTEST_DRIVER_DIR=3D\"$(top_builddir)/src/.libs\" -endif WITH_DRIVER_MODULES PROBES_O =3D if WITH_DTRACE_PROBES @@ -262,9 +260,7 @@ endif WITH_QEMU endif WITH_ATTR endif WITH_SECDRIVER_SELINUX -if WITH_DRIVER_MODULES test_programs +=3D virdrivermoduletest -endif WITH_DRIVER_MODULES # This is a fake SSH we use from virnetsockettest ssh_SOURCES =3D ssh.c @@ -1394,11 +1390,9 @@ utiltest_SOURCES =3D \ utiltest.c testutils.h testutils.c utiltest_LDADD =3D $(LDADDS) -if WITH_DRIVER_MODULES virdrivermoduletest_SOURCES =3D \ virdrivermoduletest.c testutils.h testutils.c virdrivermoduletest_LDADD =3D $(LDADDS) -endif WITH_DRIVER_MODULES if WITH_LIBVIRTD eventtest_SOURCES =3D \ 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 a= rgv[], int stdinfd =3D -1; const char *const env[] =3D { "LANG=3DC", -# if WITH_DRIVER_MODULES "LIBVIRT_DRIVER_DIR=3D" 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"); } --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:36:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501099943540822.0222622017052; Wed, 26 Jul 2017 13:12:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8449BEB2FC; Wed, 26 Jul 2017 20:12:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57A2D5D96D; Wed, 26 Jul 2017 20:12:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0C87D180597B; Wed, 26 Jul 2017 20:12:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QKCGA8016769 for ; Wed, 26 Jul 2017 16:12:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9ADEB6FDDC; Wed, 26 Jul 2017 20:12:16 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE30A60C14; Wed, 26 Jul 2017 20:12:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8449BEB2FC Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 22:12:14 +0200 Message-Id: <8b0b294cdc89d331265d925cf776fb29a60887fd.1501099726.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] security: apparmor: load the storage driver dynamically X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 26 Jul 2017 20:12:21 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In commit 5e515b542d I've attempted to fix the inability to access storage from the apparmor helper program by linking with the storage driver. By linking with the .so the linker complains that it's not portable. Fix this by loading the module dynamically as we are supposed to do. Reviewed-by: Daniel P. Berrange --- Notes: This patch is possible even with the previous patch, but it would be sl= ightly more complex, since it would need the logic to determine whether to loa= d the module or just initialize it. src/Makefile.am | 2 +- src/security/virt-aa-helper.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 471be40d1..b8e875482 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3124,7 +3124,7 @@ virt_aa_helper_LDADD =3D \ libvirt.la \ libvirt_conf.la \ libvirt_util.la \ - libvirt_driver_storage.la \ + libvirt_driver_storage_impl.la \ ../gnulib/lib/libgnu.la if WITH_DTRACE_PROBES virt_aa_helper_LDADD +=3D libvirt_probes.lo diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index a751d6deb..35dcb35bc 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -41,6 +41,7 @@ #include "viralloc.h" #include "vircommand.h" #include "virlog.h" +#include "driver.h" #include "security_driver.h" #include "security_apparmor.h" @@ -56,7 +57,6 @@ #include "virgettext.h" #include "storage/storage_source.h" -#include "storage/storage_backend.h" #define VIR_FROM_THIS VIR_FROM_SECURITY @@ -927,10 +927,10 @@ get_files(vahControl * ctl) goto cleanup; } - if (virStorageBackendDriversRegister(false) < 0) { - vah_error(ctl, 0, _("failed to register storage driver backend")); - goto cleanup; - } + /* load the storage driver so that backing store can be accessed */ +#ifdef WITH_STORAGE + virDriverLoadModule("storage", "storageRegister"); +#endif for (i =3D 0; i < ctl->def->ndisks; i++) { virDomainDiskDefPtr disk =3D ctl->def->disks[i]; --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list