[libvirt] [PATCH] spec: Add support for building the zfs storage driver

Neal Gompa ngompa13 at gmail.com
Mon Jul 17 15:32:46 UTC 2017


Where it can be supported in Fedora, the driver is built and made
available as a subpackage.

Signed-off-by: Neal Gompa <ngompa13 at gmail.com>
---
 libvirt.spec.in | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index ff090b384..ccd2429de 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -71,6 +71,14 @@
 %define with_storage_gluster 0%{!?_without_storage_gluster:1}
 %define with_numactl          0%{!?_without_numactl:1}
 
+# Enable zfs storage driver for F25+, as a compatible zfs
+# implementation is available for use.
+%if 0%{?fedora} >= 25
+    %define with_storage_zfs      0%{!?_without_storage_zfs:1}
+%else
+    %define with_storage_zfs      0
+%endif
+
 # A few optional bits off by default, we enable later
 %define with_fuse          0%{!?_without_fuse:0}
 %define with_cgconfig      0%{!?_without_cgconfig:0}
@@ -115,6 +123,12 @@
     %endif
 %endif
 
+# zfs-fuse is not available on some architectures
+%ifarch s390 s390x aarch64
+    %define with_storage_zfs 0
+%endif
+
+
 # RHEL doesn't ship OpenVZ, VBox, UML, PowerHypervisor,
 # VMware, libxenserver (xenapi), libxenlight (Xen 4.1 and newer),
 # or HyperV.
@@ -373,6 +387,11 @@ BuildRequires: glusterfs-devel >= 3.4.1
 %if %{with_storage_sheepdog}
 BuildRequires: sheepdog
 %endif
+%if %{with_storage_zfs}
+# Support any conforming implementation of zfs
+BuildRequires: /sbin/zfs
+BuildRequires: /sbin/zpool
+%endif
 %if %{with_numactl}
 # For QEMU/LXC numa info
 BuildRequires: numactl-devel
@@ -705,6 +724,21 @@ sheepdog volumes using.
 %endif
 
 
+%if %{with_storage_zfs}
+%package daemon-driver-storage-zfs
+Summary: Storage driver plugin for ZFS
+Group: Development/Libraries
+Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
+# Support any conforming implementation of zfs
+Requires: /sbin/zfs
+Requires: /sbin/zpool
+
+%description daemon-driver-storage-zfs
+The storage driver backend adding implementation of the storage APIs for
+ZFS volumes.
+%endif
+
+
 %package daemon-driver-storage
 Summary: Storage driver plugin including all backends for the libvirtd daemon
 Group: Development/Libraries
@@ -723,6 +757,9 @@ Requires: libvirt-daemon-driver-storage-rbd = %{version}-%{release}
 %if %{with_storage_sheepdog}
 Requires: libvirt-daemon-driver-storage-sheepdog = %{version}-%{release}
 %endif
+%if %{with_storage_zfs}
+Requires: libvirt-daemon-driver-storage-zfs = %{version}-%{release}
+%endif
 
 %description daemon-driver-storage
 The storage driver plugin for the libvirtd daemon, providing
@@ -1180,6 +1217,12 @@ rm -rf .git
     %define arg_storage_gluster --without-storage-gluster
 %endif
 
+%if %{with_storage_zfs}
+    %define arg_storage_zfs --with-storage-zfs
+%else
+    %define arg_storage_zfs --without-storage-zfs
+%endif
+
 %if %{with_numactl}
     %define arg_numactl --with-numactl
 %else
@@ -1288,7 +1331,7 @@ rm -f po/stamp-po
            %{?arg_storage_rbd} \
            %{?arg_storage_sheepdog} \
            %{?arg_storage_gluster} \
-           --without-storage-zfs \
+           %{?arg_storage_zfs} \
            --without-storage-vstorage \
            %{?arg_numactl} \
            %{?arg_numad} \
@@ -1851,6 +1894,11 @@ exit 0
 %{_libdir}/%{name}/storage-backend/libvirt_storage_backend_sheepdog.so
 %endif
 
+%if %{with_storage_zfs}
+%files daemon-driver-storage-zfs
+%{_libdir}/%{name}/storage-backend/libvirt_storage_backend_zfs.so
+%endif
+
 %if %{with_qemu}
 %files daemon-driver-qemu
 %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/
-- 
2.13.0




More information about the libvir-list mailing list