<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Subject changed from [neutorn] to [neutron] so that it reaches correct folders via rules ;)</div>
<div><br>
</div>
<div>—Abhishek Raut</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Paul Michali <<a href="mailto:pc@michali.net">pc@michali.net</a>><br>
<span style="font-weight:bold">Reply-To: </span>"OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, January 12, 2016 at 8:11 AM<br>
<span style="font-weight:bold">To: </span>"OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Subject: </span>[openstack-dev] [neutorn][neutron-lib] Proposal for callback mechanism migration<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">I wanted to float two ideas related to the neutron callback mechanism that is being moved to neutron-lib.
<div><br>
</div>
<div>1) API</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>I've pushed a commit to neutron-lib for review <a href="https://review.openstack.org/265997">
https://review.openstack.org/265997</a>. Please provide your comments on that as a proposed solution.</div>
<div><br>
</div>
<div>2) Migrating callbacks in neutron to use neutron-lib</div>
<div>I was thinking that the following plan (A) could work, as a way to migrate to using the callback mechanism in neutron-lib:</div>
<div>
<ol>
<li>In neutron, where callback notifications are performed, add a duplicate notification to the neutron-lib callback notification.</li><li>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</li><li>Once all the client repos have been updated, remove the old notification calls from neutron, the callback code, and callback UTs.</li></ol>
<div>An alternative proposal (B), *may* be to:</div>
</div>
<div>
<ol>
<li>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.</li><li>This and next step are the same as in proposal (A).</li></ol>
<div>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).</div>
</div>
<div><br>
</div>
<div>Looking forward to community feedback on this...</div>
<div><br>
</div>
<div>Regards,</div>
<div><br>
</div>
<div>Paul Michali (pc_m)</div>
<div><br>
</div>
</div>
</div>
</div>
</span>
</body>
</html>