From ec5370f099f6ec54d9c1f1aa037aeb79e9734dc2 Mon Sep 17 00:00:00 2001 From: Boden R Date: Wed, 14 Jun 2017 08:58:41 -0600 Subject: [PATCH] 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. Also see Ie8311f28ebac6c1990a261cc6cfa130fac0cfc5f Depends-On: I9194c7857f10392149159071cda8e080e93adc10 [1] https://github.com/openstack/neutron-lib/blob/master/doc/source/devref/callbacks.rst#event-payloads Change-Id: I3bdd5a0f4e142d1b9a59e2c110b19012ada78695 --- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- vmware_nsx/services/trunk/nsx_v3/driver.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 6b6192df7c..ed07733977 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -303,7 +303,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # Bind QoS notifications qos_driver.register(self) - def init_complete(self, resource, event, trigger, **kwargs): + def init_complete(self, resource, event, trigger, payload=None): with locking.LockManager.get_lock('plugin-init-complete'): if self.init_is_complete: # Should be called only once per worker diff --git a/vmware_nsx/services/trunk/nsx_v3/driver.py b/vmware_nsx/services/trunk/nsx_v3/driver.py index 65f03e2fad..a0d1ce3d0c 100644 --- a/vmware_nsx/services/trunk/nsx_v3/driver.py +++ b/vmware_nsx/services/trunk/nsx_v3/driver.py @@ -200,9 +200,9 @@ class NsxV3TrunkDriver(base.DriverBase): agent_type=None, can_trunk_bound_port=True) @registry.receives(trunk_consts.TRUNK_PLUGIN, [events.AFTER_INIT]) - def register(self, resource, event, trigger, **kwargs): + def register(self, resource, event, trigger, payload=None): super(NsxV3TrunkDriver, self).register( - resource, event, trigger, **kwargs) + resource, event, trigger, payload=payload) self._handler = NsxV3TrunkHandler(self.plugin_driver) for event in (events.AFTER_CREATE, events.AFTER_DELETE): registry.subscribe(self._handler.trunk_event,