[ovs-dev] [PATCH] python/ovs/poller: monkey patch to select.poll for eventlet/gevent

Ben Pfaff blp at nicira.com
Wed Aug 29 17:18:59 UTC 2012


On Tue, Aug 28, 2012 at 05:37:06PM +0900, Isaku Yamahata wrote:
> On Mon, Aug 27, 2012 at 10:10:13PM -0700, Ben Pfaff wrote:
> > On Wed, Aug 22, 2012 at 07:07:05PM +0900, Isaku Yamahata wrote:
> > > eventlet/gevent doesn't work well with select.poll because it blocks.
> > > So ovsdb python binding can't be used with eventlet/gevent.
> > > So monkey patch to select.poll with a function that emulate select.poll
> > > with select.select.
> > > 
> > > Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
> > 
> > What's going to use this?
> 
> My motivation is to use ovsdb python binding in openstack quantum which
> uses eventlet (I have Ryu plugin in mind, but I think other plugin can
> benefit) and in Ryu which uses gevent.

Hmm.  Depending on the way that the code is structured, you might be
able to just pass an object of a different class that simply implements
fd_wait, timer_wait, timer_wait_until, and immediate_wake differently.
Did you consider that solution?  Or we could define an abstract
superclass for Poller with the current Poller as the default concrete
definition.  I'd be open to that, if it would help.

> > Why is this a "monkey" patch?
> 
> You're asking about the terminology of "monkey". It is commonly used to refer
> to dynamic patching.
> http://stackoverflow.com/questions/5626193/what-is-monkey-patching

At first glance, it seems ugly.



More information about the dev mailing list