From: Daniel P. Berrangé <[email protected]>

Allow building of the storage driver to be directly controlled.

Signed-off-by: Daniel P. Berrangé <[email protected]>
---
 libvirt.spec.in   |  2 ++
 meson.build       | 14 ++++++++++----
 meson_options.txt |  2 ++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index a8034744e8..7997c305b3 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1395,6 +1395,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' 
%{_specdir}/libvirt.spec)
            -Ddriver_network=enabled \
            -Ddriver_nodedev=enabled \
            -Ddriver_nwfilter=enabled \
+           -Ddriver_storage=enabled \
            -Dstorage_fs=enabled \
            -Dstorage_lvm=enabled \
            -Dstorage_iscsi=enabled \
@@ -1482,6 +1483,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' 
%{_specdir}/libvirt.spec)
   -Ddriver_openvz=disabled \
   -Ddriver_qemu=disabled \
   -Ddriver_secrets=disabled \
+  -Ddriver_storage=disabled \
   -Ddriver_vbox=disabled \
   -Ddriver_vmware=disabled \
   -Ddriver_vz=disabled \
diff --git a/meson.build b/meson.build
index 581f642b34..16f88658c4 100644
--- a/meson.build
+++ b/meson.build
@@ -1794,7 +1794,7 @@ endif
 
 use_storage = false
 
-if conf.has('WITH_LIBVIRTD')
+if not get_option('driver_storage').disabled() and conf.has('WITH_LIBVIRTD')
   if not get_option('storage_dir').disabled()
     use_storage = true
     conf.set('WITH_STORAGE_DIR', 1)
@@ -1897,10 +1897,15 @@ if conf.has('WITH_LIBVIRTD')
     use_storage = true
     conf.set('WITH_STORAGE_ZFS', 1)
   endif
-endif
 
-if use_storage
-  conf.set('WITH_STORAGE', 1)
+  if use_storage
+    conf.set('WITH_STORAGE', 1)
+  elif get_option('driver_storage').enabled()
+    error('storage driver enabled but no storage backends enabled')
+  endif
+
+elif get_option('driver_storage').enabled() and not conf.has('WITH_LIBVIRTD')
+  error('libvirtd must be enabled to build the storage driver')
 endif
 
 
@@ -2276,6 +2281,7 @@ driver_summary = {
   'OpenVZ': conf.has('WITH_OPENVZ'),
   'QEMU': conf.has('WITH_QEMU'),
   'Remote': conf.has('WITH_REMOTE'),
+  'Storage': conf.has('WITH_STORAGE'),
   'Test': conf.has('WITH_TEST'),
   'VBox': conf.has('WITH_VBOX'),
   'VMware': conf.has('WITH_VMWARE'),
diff --git a/meson_options.txt b/meson_options.txt
index 3faed935ac..7020cb2e6a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -97,6 +97,8 @@ option('driver_nodedev', type: 'feature', value: 'auto', 
description: 'node devi
 # dep:driver_remote dep:driver_libvirtd
 option('driver_nwfilter', type: 'feature', value: 'auto', description: 
'network filter driver')
 # dep:driver_remote dep:driver_libvirtd
+option('driver_storage', type: 'feature', value: 'auto', description: 'storage 
driver')
+# dep:driver_remote dep:driver_libvirtd
 option('driver_secrets', type: 'feature', value: 'auto', description: 'local 
secrets management driver')
 
 
-- 
2.56.0

Reply via email to