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

Nir Soffer nirsof at gmail.com
Wed Sep 27 15:26:32 UTC 2017


On Wed, Sep 27, 2017 at 6:05 PM Daniel P. Berrange <berrange at redhat.com>
wrote:

> On Tue, Sep 26, 2017 at 08:05:59PM +0300, Nir Soffer wrote:
> > 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;
>
> Reviewed-by: Daniel P. Berrange <berrange at redhat.com>
>
> I'll squash in the same fix for virDomainGetDiskErrors too
>

Cool, thanks!


>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-
> https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-
> https://www.instagram.com/dberrange :|
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170927/699620f6/attachment-0001.htm>


More information about the libvir-list mailing list