Most distributions we build RPMs on don't ship a
recent enough version of libiscsi, so we can't enable
the driver unconditionally. Add an explicit dependency
on the runtime package while at it.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
libvirt.spec.in | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 63834767dd..883c8a49e7 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -71,6 +71,13 @@
%define with_storage_zfs 0
%endif
+# We need a recent enough libiscsi (>= 1.18.0)
+%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
+ %define with_storage_iscsi_direct 0%{!?_without_storage_iscsi_direct:1}
+%else
+ %define with_storage_iscsi_direct 0
+%endif
+
# A few optional bits off by default, we enable later
%define with_fuse 0%{!?_without_fuse:0}
%define with_sanlock 0%{!?_without_sanlock:0}
@@ -319,8 +326,10 @@ BuildRequires: /usr/bin/qemu-img
BuildRequires: lvm2
# For pool type=iscsi
BuildRequires: iscsi-initiator-utils
+%if %{with_storage_iscsi_direct}
# For pool type=iscsi-direct
BuildRequires: libiscsi-devel
+%endif
# For disk driver
BuildRequires: parted-devel
# For Multipath support
@@ -593,14 +602,17 @@ The storage driver backend adding implementation of the storage APIs
for iscsi
volumes using the host iscsi stack.
+%if %{with_storage_iscsi_direct}
%package daemon-driver-storage-iscsi-direct
Summary: Storage driver plugin for iscsi-direct
Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
Requires: libvirt-libs = %{version}-%{release}
+Requires: libiscsi
%description daemon-driver-storage-iscsi-direct
The storage driver backend adding implementation of the storage APIs for iscsi
volumes using libiscsi direct connection.
+%endif
%package daemon-driver-storage-mpath
@@ -679,8 +691,10 @@ Requires: libvirt-daemon-driver-storage-disk = %{version}-%{release}
Requires: libvirt-daemon-driver-storage-logical = %{version}-%{release}
Requires: libvirt-daemon-driver-storage-scsi = %{version}-%{release}
Requires: libvirt-daemon-driver-storage-iscsi = %{version}-%{release}
-Requires: libvirt-daemon-driver-storage-iscsi-direct = %{version}-%{release}
Requires: libvirt-daemon-driver-storage-mpath = %{version}-%{release}
+%if %{with_storage_iscsi_direct}
+Requires: libvirt-daemon-driver-storage-iscsi-direct = %{version}-%{release}
+%endif
%if %{with_storage_gluster}
Requires: libvirt-daemon-driver-storage-gluster = %{version}-%{release}
%endif
@@ -1134,6 +1148,12 @@ exit 1
%define arg_wireshark --without-wireshark-dissector
%endif
+%if %{with_storage_iscsi_direct}
+ %define arg_storage_iscsi_direct --with-storage-iscsi-direct
+%else
+ %define arg_storage_iscsi_direct --without-storage-iscsi-direct
+%endif
+
%define when %(date +"%%F-%%T")
%define where %(hostname)
%define who %{?packager}%{!?packager:Unknown}
@@ -1185,7 +1205,7 @@ rm -f po/stamp-po
--with-storage-fs \
--with-storage-lvm \
--with-storage-iscsi \
- --with-storage-iscsi-direct \
+ %{?arg_storage_iscsi_direct} \
--with-storage-scsi \
--with-storage-disk \
--with-storage-mpath \
@@ -1651,8 +1671,10 @@ exit 0
%files daemon-driver-storage-iscsi
%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_iscsi.so
+%if %{with_storage_iscsi_direct}
%files daemon-driver-storage-iscsi-direct
%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_iscsi-direct.so
+%endif
%files daemon-driver-storage-mpath
%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_mpath.so
--
2.17.1