Re: [PATCH v2 6/6] libvirtaio: add .drain() coroutine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 26, 2017 at 12:47:00AM +0200, Wojtek Porczyk wrote:
> On Mon, Sep 25, 2017 at 02:53:01PM +0100, Daniel P. Berrange wrote:
> > On Thu, Sep 14, 2017 at 02:41:12AM +0200, Wojtek Porczyk wrote:
> > > The intended use is to ensure that the implementation is empty, which is
> > > one way to ensure that all connections were properly closed and file
> > > descriptors reclaimed.
> > > 
> > > Signed-off-by: Wojtek Porczyk <woju@xxxxxxxxxxxxxxxxxxxxxx>
> > > ---
> (snip)
> > > +    @asyncio.coroutine
> > > +    def drain(self):
> > > +        '''Wait for the implementation to become idle.
> > > +
> > > +        This is a coroutine.
> > > +        '''
> > > +        self.log.debug('drain()')
> > > +        if self._pending:
> > > +            yield from self._finished.wait()
> > > +        self.log.debug('drain ended')
> > 
> > What is responsible for calling 'drain'  ?
> 
> Users of the library, and they do it at their pleasure. This is to allow the
> loop to actually run the scheduled tasks. After calling virConnect.close() the
> handles/timeouts aren't actually closed until the loop run the scheduled
> callbacks. In practice a simple `yield` in a coroutine would be also
> sufficient since respective Tasks are in the _ready queue and all run during
> next loop cycle, but that's not guaranteed in asyncio specification.

Ah I see.

Reviewed-by: Daniel P. Berrange <berrange@xxxxxxxxxx>



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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux