mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-12-04 20:23:46 +03:00
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>
This commit is contained in:
committed by
Daniel P. Berrange
parent
ac8faf417e
commit
7af7450b0a
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user