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
This commit is contained in:
parent
b7f2389deb
commit
ec5370f099
@ -303,7 +303,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
# Bind QoS notifications
|
# Bind QoS notifications
|
||||||
qos_driver.register(self)
|
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'):
|
with locking.LockManager.get_lock('plugin-init-complete'):
|
||||||
if self.init_is_complete:
|
if self.init_is_complete:
|
||||||
# Should be called only once per worker
|
# Should be called only once per worker
|
||||||
|
@ -200,9 +200,9 @@ class NsxV3TrunkDriver(base.DriverBase):
|
|||||||
agent_type=None, can_trunk_bound_port=True)
|
agent_type=None, can_trunk_bound_port=True)
|
||||||
|
|
||||||
@registry.receives(trunk_consts.TRUNK_PLUGIN, [events.AFTER_INIT])
|
@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(
|
super(NsxV3TrunkDriver, self).register(
|
||||||
resource, event, trigger, **kwargs)
|
resource, event, trigger, payload=payload)
|
||||||
self._handler = NsxV3TrunkHandler(self.plugin_driver)
|
self._handler = NsxV3TrunkHandler(self.plugin_driver)
|
||||||
for event in (events.AFTER_CREATE, events.AFTER_DELETE):
|
for event in (events.AFTER_CREATE, events.AFTER_DELETE):
|
||||||
registry.subscribe(self._handler.trunk_event,
|
registry.subscribe(self._handler.trunk_event,
|
||||||
|
Loading…
Reference in New Issue
Block a user