[PATCH 0/2] storage_file: De-modularize the 'fs' backend

See 1/2 for rationale. Peter Krempa (2): storage_file: de-modularize the local file backend NEWS: Mention de-modularization of the 'fs' storage file backend NEWS.rst | 9 +++++++++ libvirt.spec.in | 1 - src/storage_file/meson.build | 16 ---------------- src/storage_file/storage_file_backend.c | 11 ++++++----- 4 files changed, 15 insertions(+), 22 deletions(-) -- 2.47.1

The 'storage_file' infrastructure serves as an abstraction on top of file-looking storage technologies. Apart from local file it currently implements also a backend for 'gluster'. Historically it was all modularized and the local file module was usually packaged with the 'core' part of the storage driver. Now with split daemons one can install e.g. 'virqemud' without the storage driver core which contains the 'fs' backend module. Since the qemu driver uses the storage file backends to e.g. create storage for snapshots and backups this allows users to create a deployment where some things will not work properly. As the 'fs' backend doesn't use any code that wouldn't be linked directly anyways there's no point in actually shipping it as a module. Let's compile it in so that all deployments can use it. To achieve that, compile the source directly into the 'virt_storage_file_lib' static library and remove the loading code. Also adjust the spec file. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- libvirt.spec.in | 1 - src/storage_file/meson.build | 16 ---------------- src/storage_file/storage_file_backend.c | 11 ++++++----- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 2bc8dfd323..b1e223cfbe 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -2268,7 +2268,6 @@ exit 0 %ghost %dir %{_rundir}/libvirt/storage/ %{_libdir}/libvirt/connection-driver/libvirt_driver_storage.so %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_fs.so -%{_libdir}/libvirt/storage-file/libvirt_storage_file_fs.so %{_mandir}/man8/virtstoraged.8* %files daemon-driver-storage-disk diff --git a/src/storage_file/meson.build b/src/storage_file/meson.build index d40e98befa..27c4e5a432 100644 --- a/src/storage_file/meson.build +++ b/src/storage_file/meson.build @@ -3,9 +3,6 @@ storage_file_sources = [ 'storage_source_backingstore.c', 'storage_file_backend.c', 'storage_file_probe.c', -] - -stoarge_file_fs_sources = [ 'storage_file_backend_fs.c', ] @@ -30,19 +27,6 @@ virt_storage_file_lib = static_library( libvirt_libs += virt_storage_file_lib -if conf.has('WITH_STORAGE') - virt_modules += { - 'name': 'virt_storage_file_fs', - 'sources': [ - files(stoarge_file_fs_sources), - ], - 'include': [ - storage_inc_dir, - ], - 'install_dir': storage_file_install_dir, - } -endif - if conf.has('WITH_STORAGE_GLUSTER') virt_modules += { 'name': 'virt_storage_file_gluster', diff --git a/src/storage_file/storage_file_backend.c b/src/storage_file/storage_file_backend.c index 03583803de..1eeec5fb43 100644 --- a/src/storage_file/storage_file_backend.c +++ b/src/storage_file/storage_file_backend.c @@ -26,6 +26,7 @@ #include "virerror.h" #include "internal.h" #include "storage_file_backend.h" +#include "storage_file_backend_fs.h" #include "virlog.h" #include "virmodule.h" #include "virfile.h" @@ -40,7 +41,7 @@ VIR_LOG_INIT("storage.storage_source_backend"); static virStorageFileBackend *virStorageFileBackends[VIR_STORAGE_BACKENDS_MAX]; static size_t virStorageFileBackendsCount; -#if WITH_STORAGE_DIR || WITH_STORAGE_FS || WITH_STORAGE_GLUSTER +#if WITH_STORAGE_GLUSTER # define STORAGE_FILE_MODULE_DIR LIBDIR "/libvirt/storage-file" @@ -64,14 +65,14 @@ virStorageFileLoadBackendModule(const char *name, return ret; } -#endif /* WITH_STORAGE_DIR || WITH_STORAGE_FS || WITH_STORAGE_GLUSTER */ +#endif /* WITH_STORAGE_GLUSTER */ static int virStorageFileBackendOnceInit(void) { -#if WITH_STORAGE_DIR || WITH_STORAGE_FS - if (virStorageFileLoadBackendModule("fs", "virStorageFileFsRegister", false) < 0) + /* The backend for local files is compiled in */ + if (virStorageFileFsRegister() < 0) return -1; -#endif /* WITH_STORAGE_DIR || WITH_STORAGE_FS */ + #if WITH_STORAGE_GLUSTER if (virStorageFileLoadBackendModule("gluster", "virStorageFileGlusterRegister", false) < 0) return -1; -- 2.47.1

On a Thursday in 2025, Peter Krempa wrote:
The 'storage_file' infrastructure serves as an abstraction on top of file-looking storage technologies. Apart from local file it currently implements also a backend for 'gluster'.
Historically it was all modularized and the local file module was usually packaged with the 'core' part of the storage driver. Now with split daemons one can install e.g. 'virqemud' without the storage driver core which contains the 'fs' backend module. Since the qemu driver uses the storage file backends to e.g. create storage for snapshots and backups this allows users to create a deployment where some things will not work properly.
As the 'fs' backend doesn't use any code that wouldn't be linked directly anyways there's no point in actually shipping it as a module.
Let's compile it in so that all deployments can use it.
To achieve that, compile the source directly into the 'virt_storage_file_lib' static library and remove the loading code. Also adjust the spec file.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- libvirt.spec.in | 1 - src/storage_file/meson.build | 16 ---------------- src/storage_file/storage_file_backend.c | 11 ++++++----- 3 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in index 2bc8dfd323..b1e223cfbe 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -2268,7 +2268,6 @@ exit 0 %ghost %dir %{_rundir}/libvirt/storage/ %{_libdir}/libvirt/connection-driver/libvirt_driver_storage.so %{_libdir}/libvirt/storage-backend/libvirt_storage_backend_fs.so -%{_libdir}/libvirt/storage-file/libvirt_storage_file_fs.so %{_mandir}/man8/virtstoraged.8*
%files daemon-driver-storage-disk diff --git a/src/storage_file/meson.build b/src/storage_file/meson.build index d40e98befa..27c4e5a432 100644 --- a/src/storage_file/meson.build +++ b/src/storage_file/meson.build @@ -3,9 +3,6 @@ storage_file_sources = [ 'storage_source_backingstore.c', 'storage_file_backend.c', 'storage_file_probe.c', -] - -stoarge_file_fs_sources = [
/ˈstɔ.ɪɹd͡ʒ/ :)
'storage_file_backend_fs.c', ]
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- NEWS.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 08d1d24d48..21ba127fb2 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -11,6 +11,15 @@ For a more fine-grained view, use the `git log`_. v11.0.0 (unreleased) ==================== +* **Packaging changes** + + * De-modularize the 'fs' storage file backend + + The storage file backend for local files uses only code which we compile + into the internal libraries anyways so there's no point in having it + as a loadable module. The ``storage-file/libvirt_storage_file_fs.so`` is + now embedded directly and no longer exists. + * **Security** * **Removed features** -- 2.47.1

On a Thursday in 2025, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- NEWS.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst index 08d1d24d48..21ba127fb2 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -11,6 +11,15 @@ For a more fine-grained view, use the `git log`_. v11.0.0 (unreleased) ====================@s
v11.1.0
+* **Packaging changes** + + * De-modularize the 'fs' storage file backend + + The storage file backend for local files uses only code which we compile + into the internal libraries anyways so there's no point in having it + as a loadable module. The ``storage-file/libvirt_storage_file_fs.so`` is + now embedded directly and no longer exists.
I don't like the article without a noun and the fact that it both exists and doesn't at the same time. Consider: The ``...`` module no longer exists and its functionality is embedded directly. but what you wrote also works. Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Peter Krempa