Personal tools
You are here: Home Linux LibVirt Enable ZFS storage driver with CentOS v7 libvirt v2.0.0 storage driver

Enable ZFS storage driver with CentOS v7 libvirt v2.0.0 storage driver

ZFS support is already supported in libvirt. This change simply enables it for the CentOS binary RPM.

Steps:

  1. Install ZFS on Linux repository
  2. Make a few small changes to the RPM SPEC file
  3. Build the updated binary

 

Build

$ rpm -Uvh http://buildlogs.centos.org/c7.1611.01/libvirt/20161112020435/2.0.0-10.el7.x86_64/libvirt-2.0.0-10.el7.src.rpm
$ cd rpmbuild/SPECS/
$ rpmbuild -ba libvirt.spec 

Links

Appendices

libvirt.spec changes

$ diff -u libvirt.spec~ libvirt.spec
--- libvirt.spec~       2016-12-18 09:47:49.805082595 +1300
+++ libvirt.spec        2016-12-18 10:37:10.941082595 +1300
@@ -69,6 +69,7 @@
     %define with_storage_sheepdog 0
 %endif
 %define with_storage_gluster 0%{!?_without_storage_gluster:1}
+%define with_storage_zfs     0%{!?_without_storage_zfs:1}
 %define with_numactl          0%{!?_without_numactl:1}

 # A few optional bits off by default, we enable later
@@ -217,7 +218,7 @@
 Summary: Library providing a simple virtualization API
 Name: libvirt
 Version: 2.0.0
-Release: 10%{?dist}%{?extra_release}
+Release: 10zfs%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -593,6 +594,9 @@
 BuildRequires: glusterfs-api-devel >= 3.4.1
 BuildRequires: glusterfs-devel >= 3.4.1
 %endif
+%if %{with_storage_zfs}
+BuildRequires: zfs >= 0.6.5.8
+%endif
 %if %{with_storage_sheepdog}
 BuildRequires: sheepdog
 %endif
@@ -825,6 +829,10 @@
 # For Sheepdog support
 Requires: sheepdog
 %endif
+%if %{with_storage_zfs}
+# For ZFS support
+Requires: zfs
+%endif
 %if %{with_qemu}
 # From QEMU RPMs
 Requires: /usr/bin/qemu-img
@@ -1284,6 +1292,12 @@
     %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
@@ -1391,6 +1405,7 @@
            %{?arg_storage_rbd} \
            %{?arg_storage_sheepdog} \
            %{?arg_storage_gluster} \
+           %{?arg_storage_zfs} \
            %{?arg_numactl} \
            %{?arg_numad} \
            --with-capng \
@@ -2104,6 +2119,9 @@


 %changelog
+* Sun Dec 18 2016 Greg Brackley <greg-libvirt-zfs@lucidsolutions.co.nz> - 2.0.0-10
+- enable ZFS support
+
 * Wed Sep 21 2016 Jiri Denemark <jdenemar@redhat.com> - 2.0.0-10
 - virtlogd: Don't stop or restart along with libvirtd (rhbz#1372576)

 

Related content
Document Actions