[libvirt] [PATCH python] Release the GIL during virDomainGetMemoryStats

Nir Soffer nirsof at gmail.com
Tue Sep 26 17:05:59 UTC 2017


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 at gmail.com>
---
 libvirt-override.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libvirt-override.c b/libvirt-override.c
index 9eba4ed..0e33afb 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;
 
-- 
2.9.5




More information about the libvir-list mailing list