diff --git a/SOURCES/libvirt-python-Release-the-GIL-during-virDomainGetMemoryStats-virDomainGetDiskErrors.patch b/SOURCES/libvirt-python-Release-the-GIL-during-virDomainGetMemoryStats-virDomainGetDiskErrors.patch
new file mode 100644
index 0000000..90d8b2d
--- /dev/null
+++ b/SOURCES/libvirt-python-Release-the-GIL-during-virDomainGetMemoryStats-virDomainGetDiskErrors.patch
@@ -0,0 +1,61 @@
+From f4d5082f6946e4afb4326d1d37f413fed16bf7e2 Mon Sep 17 00:00:00 2001
+Message-Id: <f4d5082f6946e4afb4326d1d37f413fed16bf7e2@dist-git>
+From: Nir Soffer <nirsof@gmail.com>
+Date: Mon, 2 Oct 2017 09:59:00 +0200
+Subject: [PATCH] Release the GIL during virDomainGetMemoryStats &
+ virDomainGetDiskErrors
+
+We discovered that the entire python process get stuck for about 30
+seconds when calling virDomain.getMemoryStats() if libvirt is stuck in
+virConnect.getAllDomainStats() on inaccessible storage. This blocking
+cause a horrible mess in oVirt.
+
+This patches adds the standard *_ALLOW_THREADS around the call to avoid
+this unwanted blocking.
+
+Signed-off-by: Nir Soffer <nirsof@gmail.com>
+(cherry picked from commit 7af7450b0ac6bd69181f3c8d2360f4f97478191c)
+
+Conflicts:
+        libvirt-override.c
+
+Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1497197
+
+Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
+Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
+---
+ libvirt-override.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/libvirt-override.c b/libvirt-override.c
+index 93c7ef0..dc81274 100644
+--- a/libvirt-override.c
++++ b/libvirt-override.c
+@@ -363,8 +363,11 @@ libvirt_virDomainMemoryStats(PyObject *self ATTRIBUTE_UNUSED,
+         return NULL;
+     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+ 
++    LIBVIRT_BEGIN_ALLOW_THREADS;
+     nr_stats = virDomainMemoryStats(domain, stats,
+                                     VIR_DOMAIN_MEMORY_STAT_NR, 0);
++    LIBVIRT_END_ALLOW_THREADS;
++
+     if (nr_stats == -1)
+         return VIR_PY_NONE;
+ 
+@@ -4864,7 +4867,11 @@ libvirt_virDomainGetDiskErrors(PyObject *self ATTRIBUTE_UNUSED,
+ 
+     domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+ 
+-    if ((count = virDomainGetDiskErrors(domain, NULL, 0, 0)) < 0)
++    LIBVIRT_BEGIN_ALLOW_THREADS;
++    count = virDomainGetDiskErrors(domain, NULL, 0, 0);
++    LIBVIRT_END_ALLOW_THREADS;
++
++    if (count < 0)
+         return VIR_PY_NONE;
+     ndisks = count;
+ 
+-- 
+2.14.2
+
diff --git a/SPECS/libvirt-python.spec b/SPECS/libvirt-python.spec
index bb8774d..4b8f547 100644
--- a/SPECS/libvirt-python.spec
+++ b/SPECS/libvirt-python.spec
@@ -7,8 +7,10 @@
 Summary: The libvirt virtualization API python2 binding
 Name: libvirt-python
 Version: 3.2.0
-Release: 3%{?dist}%{?extra_release}
+Release: 3%{?dist}.1%{?extra_release}
 Source0: http://libvirt.org/sources/python/%{name}-%{version}.tar.gz
+Patch1: libvirt-python-Release-the-GIL-during-virDomainGetMemoryStats-virDomainGetDiskErrors.patch
+
 Url: http://libvirt.org
 License: LGPLv2+
 Group: Development/Libraries
@@ -55,6 +57,42 @@ of recent versions of Linux (and other OSes).
 # for the -python3 package
 find examples -type f -exec chmod 0644 \{\} \;
 
+# Patches have to be stored in a temporary file because RPM has
+# a limit on the length of the result of any macro expansion;
+# if the string is longer, it's silently cropped
+%{lua:
+    tmp = os.tmpname();
+    f = io.open(tmp, "w+");
+    count = 0;
+    for i, p in ipairs(patches) do
+        f:write(p.."\n");
+        count = count + 1;
+    end;
+    f:close();
+    print("PATCHCOUNT="..count.."\n")
+    print("PATCHLIST="..tmp.."\n")
+}
+
+git init -q
+git config user.name rpm-build
+git config user.email rpm-build
+git config gc.auto 0
+git add .
+git commit -q -a --author 'rpm-build <rpm-build>' \
+           -m '%{name}-%{version} base'
+
+COUNT=$(grep '\.patch$' $PATCHLIST | wc -l)
+if [ $COUNT -ne $PATCHCOUNT ]; then
+    echo "Found $COUNT patches in $PATCHLIST, expected $PATCHCOUNT"
+    exit 1
+fi
+if [ $COUNT -gt 0 ]; then
+    xargs git am <$PATCHLIST || exit 1
+fi
+echo "Applied $COUNT patches"
+rm -f $PATCHLIST
+
+
 %build
 CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
 %if %{with_python3}
@@ -96,6 +134,9 @@ rm -f %{buildroot}%{_libdir}/python*/site-packages/*egg-info
 %endif
 
 %changelog
+* Mon Oct  2 2017 Jiri Denemark <jdenemar@redhat.com> - 3.2.0-3.el7_4.1
+- Release the GIL during virDomainGetMemoryStats & virDomainGetDiskErrors (rhbz#1497197)
+
 * Wed Jun  7 2017 Jiri Denemark <jdenemar@redhat.com> - 3.2.0-3
 - rebuild libvirt-python to pickup new flag for virDomainBlockCopy (rhbz#1459183)