From nobody Sat Apr 20 08:04:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1487678274534911.5170442574185; Tue, 21 Feb 2017 03:57:54 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsILH017555; Tue, 21 Feb 2017 06:54:18 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsHfs020463 for ; Tue, 21 Feb 2017 06:54:17 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsFOX017607; Tue, 21 Feb 2017 06:54:16 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 12:55:07 +0100 Message-Id: <56878d0d21a11fea3bc4e22376a758530feaa0fb.1487678014.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 1/5] spec: Don't check for storage driver backends in configure script 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Explicitly enable --with-storage-scsi and disable --without-storage-zfs and --without-storage-vstorage so that the configure script doesn't check for them. Note that --with-storage-dir is enabled by default. --- Notes: v2: - new in series libvirt.spec.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libvirt.spec.in b/libvirt.spec.in index ec199e9c8..f4ea89d77 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1182,11 +1182,14 @@ rm -f po/stamp-po --with-storage-fs \ --with-storage-lvm \ --with-storage-iscsi \ + --with-storage-scsi \ --with-storage-disk \ --with-storage-mpath \ %{?arg_storage_rbd} \ %{?arg_storage_sheepdog} \ %{?arg_storage_gluster} \ + --without-storage-zfs \ + --without-storage-vstorage \ %{?arg_numactl} \ %{?arg_numad} \ --with-capng \ --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 08:04:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487678314162166.92464634773307; Tue, 21 Feb 2017 03:58:34 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsbm9003268; Tue, 21 Feb 2017 06:54:37 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsIWi020471 for ; Tue, 21 Feb 2017 06:54:18 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsFOY017607; Tue, 21 Feb 2017 06:54:17 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 12:55:08 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 2/5] storage: Turn storage backends into dynamic 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If driver modules are enabled turn storage driver backends into dynamically loadable objects. This will allow greater modularity for binary distributions, where heavyweight dependencies as rbd and gluster can be avoided by selecting only a subset of drivers if the rest is not necessary. The storage modules are installed into 'LIBDIR/libvirt/storage-backend/' and users can't override the location by using 'LIBVIRT_STORAGE_BACKEND_DIR' environment variable. rpm based distros will at this point install all the backends when libvirt-daemon-driver-storage package is installed. --- libvirt.spec.in | 17 +++++++++ src/Makefile.am | 85 +++++++++++++++++++++++++++++++++++++++= +++- src/storage/storage_backend.c | 60 +++++++++++++++++++++++------- tests/Makefile.am | 4 +- 4 files changed, 151 insertions(+), 15 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index f4ea89d77..a9af97f10 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1239,6 +1239,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*= .la rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.a rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.la rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/connection-driver/*.a +rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.la +rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/storage-backend/*.a %if %{with_wireshark} %if 0%{fedora} >=3D 24 rm -f $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.la @@ -1694,6 +1696,21 @@ exit 0 %files daemon-driver-storage %attr(0755, root, root) %{_libexecdir}/libvirt_parthelper %{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_fs.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_disk.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_logical.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_scsi.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_iscsi.so +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_mpath.so +%if %{with_storage_gluster} +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_gluster.so +%endif +%if %{with_storage_rbd} +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_rbd.so +%endif +%if %{with_storage_sheepdog} +%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_sheepdog.so +%endif %if %{with_qemu} %files daemon-driver-qemu diff --git a/src/Makefile.am b/src/Makefile.am index 7099f1b88..a85cd0df8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -972,9 +972,12 @@ SECRET_DRIVER_SOURCES =3D \ secret/secret_driver.h secret/secret_driver.c # Storage backend specific impls +STORAGE_DRIVER_BACKEND_SOURCES =3D \ + storage/storage_backend.h storage/storage_backend.c + STORAGE_DRIVER_SOURCES =3D \ storage/storage_driver.h storage/storage_driver.c \ - storage/storage_backend.h storage/storage_backend.c \ + $(STORAGE_DRIVER_BACKEND_SOURCES) \ storage/storage_util.h storage/storage_util.c STORAGE_DRIVER_FS_SOURCES =3D \ @@ -1661,6 +1664,12 @@ if WITH_BLKID 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 @@ -1682,8 +1691,14 @@ 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 @@ -1693,9 +1708,15 @@ 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 @@ -1706,9 +1727,15 @@ 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 @@ -1717,8 +1744,14 @@ 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 @@ -1730,9 +1763,15 @@ 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 @@ -1741,8 +1780,14 @@ 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 @@ -1753,8 +1798,14 @@ 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 @@ -1764,9 +1815,23 @@ libvirt_storage_backend_sheepdog_la_CFLAGS =3D \ -I$(srcdir)/conf \ $(AM_CFLAGS) +libvirt_storage_backend_sheepdog_priv_la_SOURCES =3D \ + $(STORAGE_DRIVER_SHEEPDOG_SOURCES) \ + $(STORAGE_DRIVER_BACKEND_SOURCES) +libvirt_storage_backend_sheepdog_priv_la_CFLAGS =3D \ + -I$(srcdir)/conf \ + $(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 @@ -1778,9 +1843,15 @@ 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 @@ -1789,8 +1860,14 @@ 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 @@ -1800,9 +1877,15 @@ 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 diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index d8099be36..32f45e841 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -33,6 +33,8 @@ #include "virstoragefile.h" #include "storage_backend.h" #include "virlog.h" +#include "virfile.h" +#include "configmake.h" #if WITH_STORAGE_LVM # include "storage_backend_logical.h" @@ -79,45 +81,77 @@ static size_t virStorageBackendsCount; static virStorageFileBackendPtr virStorageFileBackends[VIR_STORAGE_BACKEND= S_MAX]; static size_t virStorageFileBackendsCount; -#define VIR_STORAGE_BACKEND_REGISTER(name) = \ - if (name() < 0) = \ +#if WITH_DRIVER_MODULES + +# define STORAGE_BACKEND_MODULE_DIR LIBDIR "/libvirt/storage-backend" + +static int +virStorageDriverLoadBackendModule(const char *name, + const char *regfunc) +{ + char *modfile =3D NULL; + int ret; + + if (!(modfile =3D virFileFindResourceFull(name, + "libvirt_storage_backend_", + ".so", + abs_topbuilddir "/src/.libs", + STORAGE_BACKEND_MODULE_DIR, + "LIBVIRT_STORAGE_BACKEND_DIR")= )) + return 1; + + ret =3D virDriverLoadModuleFull(modfile, regfunc, NULL); + + VIR_FREE(modfile); + + return ret; +} + + +# define VIR_STORAGE_BACKEND_REGISTER(func, module) = \ + if (virStorageDriverLoadBackendModule(module, #func) < 0) = \ + return -1 +#else +# define VIR_STORAGE_BACKEND_REGISTER(func, module) = \ + if (func() < 0) = \ return -1 +#endif int virStorageBackendDriversRegister(void) { #if WITH_STORAGE_DIR || WITH_STORAGE_FS - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendFsRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendFsRegister, "fs"); #endif #if WITH_STORAGE_LVM - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendLogicalRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendLogicalRegister, "logica= l"); #endif #if WITH_STORAGE_ISCSI - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendISCSIRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendISCSIRegister, "iscsi"); #endif #if WITH_STORAGE_SCSI - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSCSIRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSCSIRegister, "scsi"); #endif #if WITH_STORAGE_MPATH - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendMpathRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendMpathRegister, "mpath"); #endif #if WITH_STORAGE_DISK - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendDiskRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendDiskRegister, "disk"); #endif #if WITH_STORAGE_RBD - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRBDRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRBDRegister, "rbd"); #endif #if WITH_STORAGE_SHEEPDOG - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSheepdogRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSheepdogRegister, "sheep= dog"); #endif #if WITH_STORAGE_GLUSTER - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendGlusterRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendGlusterRegister, "gluste= r"); #endif #if WITH_STORAGE_ZFS - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendZFSRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendZFSRegister, "zfs"); #endif #if WITH_STORAGE_VSTORAGE - VIR_STORAGE_BACKEND_REGISTER(virStorageBackendVstorageRegister); + VIR_STORAGE_BACKEND_REGISTER(virStorageBackendVstorageRegister, "vstor= age"); #endif return 0; diff --git a/tests/Makefile.am b/tests/Makefile.am index 32a7282d4..35e82abf5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -805,7 +805,9 @@ storagebackendsheepdogtest_SOURCES =3D \ storagebackendsheepdogtest.c \ testutils.c testutils.h storagebackendsheepdogtest_LDADD =3D \ - ../src/libvirt_driver_storage_impl.la $(LDADDS) + ../src/libvirt_driver_storage_impl.la \ + ../src/libvirt_storage_backend_sheepdog_priv.la \ + $(LDADDS) else ! WITH_STORAGE_SHEEPDOG EXTRA_DIST +=3D storagebackendsheepdogtest.c endif ! WITH_STORAGE_SHEEPDOG --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 08:04:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1487678293554920.0027420501175; Tue, 21 Feb 2017 03:58:13 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsbOF028226; Tue, 21 Feb 2017 06:54:37 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsJYT020482 for ; Tue, 21 Feb 2017 06:54:19 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsFOZ017607; Tue, 21 Feb 2017 06:54:18 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 12:55:09 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 3/5] tests: drivermodule: Make sure that all compiled storage backends can be loaded 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a new storage driver registration function that will force the backend code to fail if any of the storage backend modules can't be loaded. This will make sure that they work and are present. --- src/storage/storage_backend.c | 16 ++++++++++++---- src/storage/storage_backend.h | 2 +- src/storage/storage_driver.c | 19 +++++++++++++++++-- src/storage/storage_driver.h | 1 + tests/virdrivermoduletest.c | 2 +- tests/virstoragetest.c | 2 +- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 32f45e841..ce278b99c 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -87,7 +87,8 @@ static size_t virStorageFileBackendsCount; static int virStorageDriverLoadBackendModule(const char *name, - const char *regfunc) + const char *regfunc, + bool forceload) { char *modfile =3D NULL; int ret; @@ -100,7 +101,14 @@ virStorageDriverLoadBackendModule(const char *name, "LIBVIRT_STORAGE_BACKEND_DIR")= )) return 1; - ret =3D virDriverLoadModuleFull(modfile, regfunc, NULL); + if ((ret =3D virDriverLoadModuleFull(modfile, regfunc, NULL)) !=3D 0) { + if (forceload) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to load storage backend module '%s'"), + name); + ret =3D -1; + } + } VIR_FREE(modfile); @@ -109,7 +117,7 @@ virStorageDriverLoadBackendModule(const char *name, # define VIR_STORAGE_BACKEND_REGISTER(func, module) = \ - if (virStorageDriverLoadBackendModule(module, #func) < 0) = \ + if (virStorageDriverLoadBackendModule(module, #func, allbackends) < 0)= \ return -1 #else # define VIR_STORAGE_BACKEND_REGISTER(func, module) = \ @@ -118,7 +126,7 @@ virStorageDriverLoadBackendModule(const char *name, #endif int -virStorageBackendDriversRegister(void) +virStorageBackendDriversRegister(bool allbackends ATTRIBUTE_UNUSED) { #if WITH_STORAGE_DIR || WITH_STORAGE_FS VIR_STORAGE_BACKEND_REGISTER(virStorageBackendFsRegister, "fs"); diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index ca6c19c45..f433071f4 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -198,7 +198,7 @@ struct _virStorageFileBackend { virStorageFileBackendChown storageFileChown; }; -int virStorageBackendDriversRegister(void); +int virStorageBackendDriversRegister(bool allmodules); int virStorageBackendRegister(virStorageBackendPtr backend); int virStorageBackendFileRegister(virStorageFileBackendPtr backend); diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 7fafbcf75..0bc047f23 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -2838,9 +2838,10 @@ static virStateDriver stateDriver =3D { .stateReload =3D storageStateReload, }; -int storageRegister(void) +static int +storageRegisterFull(bool allbackends) { - if (virStorageBackendDriversRegister() < 0) + if (virStorageBackendDriversRegister(allbackends) < 0) return -1; if (virSetSharedStorageDriver(&storageDriver) < 0) return -1; @@ -2850,6 +2851,20 @@ int storageRegister(void) } +int +storageRegister(void) +{ + return storageRegisterFull(false); +} + + +int +storageRegisterAll(void) +{ + return storageRegisterFull(true); +} + + /* ----------- file handlers cooperating with storage driver -------------= -- */ static bool virStorageFileIsInitialized(const virStorageSource *src) diff --git a/src/storage/storage_driver.h b/src/storage/storage_driver.h index 682c9ff82..f0aca3671 100644 --- a/src/storage/storage_driver.h +++ b/src/storage/storage_driver.h @@ -70,5 +70,6 @@ char *virStoragePoolObjBuildTempFilePath(virStoragePoolOb= jPtr pool, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; int storageRegister(void); +int storageRegisterAll(void); #endif /* __VIR_STORAGE_DRIVER_H__ */ diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c index e440350c2..13d51a8e9 100644 --- a/tests/virdrivermoduletest.c +++ b/tests/virdrivermoduletest.c @@ -71,7 +71,7 @@ mymain(void) TEST("interface"); #endif #ifdef WITH_STORAGE - TEST("storage"); + TEST_FULL("storage", "storageRegisterAll"); #endif #ifdef WITH_NODE_DEVICES TEST("nodedev"); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index d715fd762..36567753b 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -732,7 +732,7 @@ mymain(void) virStorageSourcePtr chain2; /* short for chain->backingStore */ virStorageSourcePtr chain3; /* short for chain2->backingStore */ - if (virStorageBackendDriversRegister() < 0) + if (virStorageBackendDriversRegister(false) < 0) return -1; /* Prep some files with qemu-img; if that is not found on PATH, or --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 08:04:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487678311107738.1347555684079; Tue, 21 Feb 2017 03:58:31 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsmNP003287; Tue, 21 Feb 2017 06:54:48 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsK2Q020489 for ; Tue, 21 Feb 2017 06:54:20 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsFOa017607; Tue, 21 Feb 2017 06:54:19 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 12:55:10 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 4/5] spec: Modularize the storage driver 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Create a new set of sub-packages containing the new storage driver modules so that certain heavy-weight backends (gluster, rbd) can be installed separately only if required. To keep backward compatibility the 'libvirt-driver-storage' package will be turned into a virtual package pulling in all the new storage backend sub-packages. The storage driver module will be moved into libvirt-driver-storage-core including the filesystem backend which is mandatory. This then allows to make libvirt-daemon-driver-qemu depend only on the core of the storage driver. All other meta-packages still depend on the full storage driver and thus pull in all the backends. --- libvirt.spec.in | 168 +++++++++++++++++++++++++++++++++++++++++++++++-----= ---- 1 file changed, 143 insertions(+), 25 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index a9af97f10..7f3d18f72 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -585,35 +585,13 @@ Requires: libvirt-daemon =3D %{version}-%{release} The secret driver plugin for the libvirtd daemon, providing an implementation of the secret key APIs. - -%package daemon-driver-storage -Summary: Storage driver plugin for the libvirtd daemon +%package daemon-driver-storage-core +Summary: Storage driver plugin including base backends for the libvirtd da= emon Group: Development/Libraries Requires: libvirt-daemon =3D %{version}-%{release} Requires: nfs-utils # For mkfs Requires: util-linux -# For glusterfs -%if 0%{?fedora} -Requires: glusterfs-client >=3D 2.0.1 -%endif -# gluster cli tool for pool discovery -%if (0%{?fedora} || 0%{?with_storage_gluster}) -Requires: /usr/sbin/gluster -%endif -# For LVM drivers -Requires: lvm2 -# For ISCSI driver -Requires: iscsi-initiator-utils -# For disk driver -Requires: parted -Requires: device-mapper -# For multipath support -Requires: device-mapper -%if %{with_storage_sheepdog} -# For Sheepdog support -Requires: sheepdog -%endif %if %{with_qemu} # From QEMU RPMs Requires: /usr/bin/qemu-img @@ -624,6 +602,128 @@ Requires: /usr/sbin/qcow-create %endif %endif +%description daemon-driver-storage-core +The storage driver plugin for the libvirtd daemon, providing +an implementation of the storage APIs using files, local disks, LVM, SCSI, +iSCSI, and multipath storage. + +%package daemon-driver-storage-logical +Summary: Storage driver plugin for lvm volumes +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: lvm2 + +%description daemon-driver-storage-logical +The storage driver backend adding implementation of the storage APIs for b= lock +volumes using lvm. + + +%package daemon-driver-storage-disk +Summary: Storage driver plugin for disk +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: parted +Requires: device-mapper + +%description daemon-driver-storage-disk +The storage driver backend adding implementation of the storage APIs for b= lock +volumes using the host disks. + + +%package daemon-driver-storage-scsi +Summary: Storage driver plugin for local scsi devices +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} + +%description daemon-driver-storage-scsi +The storage driver backend adding implementation of the storage APIs for s= csi +host devices. + + +%package daemon-driver-storage-iscsi +Summary: Storage driver plugin for iscsi +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: iscsi-initiator-utils + +%description daemon-driver-storage-iscsi +The storage driver backend adding implementation of the storage APIs for i= scsi +volumes using the host iscsi stack. + + +%package daemon-driver-storage-mpath +Summary: Storage driver plugin for multipath volumes +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: device-mapper + +%description daemon-driver-storage-mpath +The storage driver backend adding implementation of the storage APIs for +multipath storage using device mapper. + + +%if %{with_storage_gluster} +%package daemon-driver-storage-gluster +Summary: Storage driver plugin for gluster +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} + %if 0%{?fedora} +Requires: glusterfs-client >=3D 2.0.1 + %endif + %if (0%{?fedora} || 0%{?with_storage_gluster}) +Requires: /usr/sbin/gluster + %endif + +%description daemon-driver-storage-gluster +The storage driver backend adding implementation of the storage APIs for g= luster +volumes using libgfapi. +%endif + + +%if %{with_storage_rbd} +%package daemon-driver-storage-rbd +Summary: Storage driver plugin for rbd +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} + +%description daemon-driver-storage-rbd +The storage driver backend adding implementation of the storage APIs for r= bd +volumes using the ceph protocol. +%endif + + +%if %{with_storage_sheepdog} +%package daemon-driver-storage-sheepdog +Summary: Storage driver plugin for sheepdog +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: sheepdog + +%description daemon-driver-storage-sheepdog +The storage driver backend adding implementation of the storage APIs for +sheepdog volumes using. +%endif + + +%package daemon-driver-storage +Summary: Storage driver plugin including all backends for the libvirtd dae= mon +Group: Development/Libraries +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-disk =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-logical =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-scsi =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-iscsi =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-mpath =3D %{version}-%{release} +%if %{with_storage_gluster} +Requires: libvirt-daemon-driver-storage-gluster =3D %{version}-%{release} +%endif +%if %{with_storage_rbd} +Requires: libvirt-daemon-driver-storage-rbd =3D %{version}-%{release} +%endif +%if %{with_storage_sheepdog} +Requires: libvirt-daemon-driver-storage-sheepdog =3D %{version}-%{release} +%endif + %description daemon-driver-storage The storage driver plugin for the libvirtd daemon, providing an implementation of the storage APIs using LVM, iSCSI, @@ -637,7 +737,7 @@ Group: Development/Libraries Requires: libvirt-daemon =3D %{version}-%{release} # There really is a hard cross-driver dependency here Requires: libvirt-daemon-driver-network =3D %{version}-%{release} -Requires: libvirt-daemon-driver-storage =3D %{version}-%{release} +Requires: libvirt-daemon-driver-storage-core =3D %{version}-%{release} Requires: /usr/bin/qemu-img # For image compression Requires: gzip @@ -1694,21 +1794,39 @@ exit 0 %{_libdir}/%{name}/connection-driver/libvirt_driver_secret.so %files daemon-driver-storage + +%files daemon-driver-storage-core %attr(0755, root, root) %{_libexecdir}/libvirt_parthelper %{_libdir}/%{name}/connection-driver/libvirt_driver_storage.so %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_fs.so + +%files daemon-driver-storage-disk %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_disk.so + +%files daemon-driver-storage-logical %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_logical.so + +%files daemon-driver-storage-scsi %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_scsi.so + +%files daemon-driver-storage-iscsi %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_iscsi.so + +%files daemon-driver-storage-mpath %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_mpath.so + %if %{with_storage_gluster} +%files daemon-driver-storage-gluster %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_gluster.so %endif + %if %{with_storage_rbd} +%files daemon-driver-storage-rbd %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_rbd.so %endif + %if %{with_storage_sheepdog} +%files daemon-driver-storage-sheepdog %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_sheepdog.so %endif --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 08:04:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487678262326982.5383522168416; Tue, 21 Feb 2017 03:57:42 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsQCv003254; Tue, 21 Feb 2017 06:54:26 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1LBsLTx020500 for ; Tue, 21 Feb 2017 06:54:21 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LBsFOb017607; Tue, 21 Feb 2017 06:54:20 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 21 Feb 2017 12:55:11 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 5/5] news: Mention storage driver split 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 8d53e0797..6cd469ec5 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -110,6 +110,16 @@ to/from xl.cfg. + + + storage: modularize the storage driver + + + Split up the storage driver backends into loadable modules so th= at + binary distributions don't have to compromise on shipping the st= orage + driver with all backends which may pull in too many dependencies. + +
--=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list