[openstack-dev] [neutron][neutron-lib] Proposal for callback mechanism migration

Abhishek Raut rauta at vmware.com
Wed Jan 13 00:35:03 UTC 2016


Subject changed from [neutorn] to [neutron] so that it reaches correct folders via rules ;)

-Abhishek Raut

From: Paul Michali <pc at michali.net<mailto:pc at michali.net>>
Reply-To: "OpenStack Development Mailing List (not for usage questions)" <openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>>
Date: Tuesday, January 12, 2016 at 8:11 AM
To: "OpenStack Development Mailing List (not for usage questions)" <openstack-dev at lists.openstack.org<mailto:openstack-dev at lists.openstack.org>>
Subject: [openstack-dev] [neutorn][neutron-lib] Proposal for callback mechanism migration

I wanted to float two ideas related to the neutron callback mechanism that is being moved to neutron-lib.

1) API
The current API uses kwargs as a way for the notifier to pass information to the subscribers listening (callbacks). One issue with this, is that the actual keyword arguments used, could clash with the positional argument names.

To address this, I'm proposing that we do the same as is done in the Requests package to pass a payload to the get() method, where a 'params' positional argument is used to hold a dict with the arguments to be passed to the callback.

I've pushed a commit to neutron-lib for review https://review.openstack.org/265997. Please provide your comments on that as a proposed solution.

2) Migrating callbacks in neutron to use neutron-lib
I was thinking that the following plan (A) could work, as a way to migrate to using the callback mechanism in neutron-lib:

  1.  In neutron, where callback notifications are performed, add a duplicate notification to the neutron-lib callback notification.
  2.  In each client repo, change the subscription to subscribe to the neutron-lib version of the resource/event tuple. At this time, the clients could be altered to use the new 'params' positional argument
  3.  Once all the client repos have been updated, remove the old notification calls from neutron, the callback code, and callback UTs.

An alternative proposal (B), *may* be to:

  1.  Change the notification wrapper method in registry.py to call both the existing callback notify() and the one in neutron_lib. For the latter, the kwargs would need to be stored in the params dict.
  2.  This and next step are the same as in proposal (A).

I think plan A gives more flexibility in converting kwargs into a param dict, at the expense of more of a change impact (32 places/9 files).

Looking forward to community feedback on this...

Regards,

Paul Michali (pc_m)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160113/e80cbd1a/attachment.html>


More information about the OpenStack-dev mailing list