diff options
author | Nir Soffer <nirsof@gmail.com> | 2017-09-26 20:05:59 +0300 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2017-09-27 16:07:13 +0100 |
commit | 7af7450b0ac6bd69181f3c8d2360f4f97478191c (patch) | |
tree | f5afc4f4d053fba9b62cea28394007874c84c5f4 | |
parent | ac8faf417ed4fbea0e3a579ffd365bbcc09d913f (diff) | |
download | libvirt-python-7af7450b0ac6bd69181f3c8d2360f4f97478191c.tar.gz |
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>
-rw-r--r-- | libvirt-override.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libvirt-override.c b/libvirt-override.c index bde7f4b..f5ff605 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 == (unsigned int)-1) return VIR_PY_NONE; @@ -4872,7 +4875,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; |