use new payload objects for *_INIT callbacks

Part of the work we did while rehoming the callback modules introduced
the notion of payload objects [1] to replace the unstructured kwargs
used today. When using payloads event sources need to use publish()
rather than notify() to trigger the callback(s) and pass along a payload
object (if needed).

This patch begins to move us onto the payload objects by updating
BEFORE_INIT and AFTER_INIT event types to use the payloads.

Depends-On: I9194c7857f10392149159071cda8e080e93adc10

[1] https://github.com/openstack/neutron-lib/blob/master/doc/source/devref/callbacks.rst#event-payloads

Change-Id: I0485f4cf3c4eb9b0cbbe8245c48f322c0e807236
This commit is contained in:
Boden R 2017-09-19 11:12:42 -06:00 committed by Dima Kuznetsov
parent 97d441f9b9
commit b6f239078a
2 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ class DFMechDriver(api.MechanismDriver):
self.subscribe_registries()
df_qos.register()
def post_fork_initialize(self, resource, event, trigger, **kwargs):
def post_fork_initialize(self, resource, event, trigger, payload=None):
# NOTE(nick-ma-z): This will initialize all workers (API, RPC,
# plugin service, etc) and threads with network connections.
self.nb_api = api_nb.NbApi.get_instance(True)

View File

@ -49,13 +49,13 @@ class DfTrunkDriver(base.DriverBase, mixins.LazyNbApiMixin):
except cfg.NoSuchOptError:
return False
def register(self, resource, event, trigger, **kwargs):
def register(self, resource, event, trigger, payload=None):
"""
Register the Dragonflow driver. This means registering to the
add subport and delete subport events
"""
super(DfTrunkDriver, self).register(resource, event, trigger,
**kwargs)
payload=payload)
self._register_trunk_events()
self._register_subport_events()