use callback payloads for _SPAWN events
This patch switches callbacks over to the payload object style events [1] for BEFORE_SPAWN and AFTER_SPAWN based notifications. As no event data is passed for SPAWN notifications, an actual payload object is not needed and thus this change uses publish() rather than notify() and updates and callback receivers to accept the payload parameter. Depends-On: Ifad4781d82aa07f213f4e075b0c9455aa95e94bb [1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html#event-payloads Change-Id: Icca5213d7372ea28204db50108d5f77e1acf400d
This commit is contained in:
parent
6ddff8c110
commit
fdb1b6c915
@ -117,7 +117,7 @@ class NsxvFlowClassifierDriver(fc_driver.FlowClassifierDriverBase):
|
||||
self._profile_id,
|
||||
et.tostring(profile_binding, encoding="us-ascii"))
|
||||
|
||||
def init_complete(self, resource, event, trigger, **kwargs):
|
||||
def init_complete(self, resource, event, trigger, payload=None):
|
||||
if self._is_new_security_group:
|
||||
# add existing VMs to the new security group
|
||||
# This code must run after init is done
|
||||
|
@ -72,7 +72,7 @@ class CommonEdgeFwaasV3Driver(fwaas_base.FwaasDriverBase):
|
||||
def nsx_router(self):
|
||||
return self.nsxlib.logical_router
|
||||
|
||||
def check_backend_version(self, resource, event, trigger, **kwargs):
|
||||
def check_backend_version(self, resource, event, trigger, payload=None):
|
||||
if (self.core_plugin and
|
||||
not self.nsxlib.feature_supported(consts.FEATURE_ROUTER_FIREWALL)):
|
||||
# router firewall is not supported
|
||||
|
@ -74,7 +74,8 @@ class NsxV3Driver(l2gateway_db.L2GatewayMixin):
|
||||
registry.subscribe(self._ensure_default_l2_gateway, resources.PROCESS,
|
||||
events.BEFORE_SPAWN)
|
||||
|
||||
def _ensure_default_l2_gateway(self, resource, event, trigger, **kwargs):
|
||||
def _ensure_default_l2_gateway(self, resource, event,
|
||||
trigger, payload=None):
|
||||
"""
|
||||
Create a default logical L2 gateway.
|
||||
|
||||
|
@ -82,8 +82,8 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase,
|
||||
"nsx_v3")
|
||||
nsx_v3_driver.NsxV3Driver(mock.MagicMock())
|
||||
# fake the callback invoked after init
|
||||
registry.notify(resources.PROCESS, events.BEFORE_SPAWN,
|
||||
mock.MagicMock())
|
||||
registry.publish(resources.PROCESS, events.BEFORE_SPAWN,
|
||||
mock.MagicMock())
|
||||
l2gws = self.driver._get_l2_gateways(self.context)
|
||||
def_bridge_cluster_id = (
|
||||
self.nsxlib.bridge_cluster.get_id_by_name_or_id(
|
||||
@ -107,8 +107,8 @@ class TestNsxV3L2GatewayDriver(test_l2gw_db.L2GWTestCase,
|
||||
for i in range(0, 2):
|
||||
nsx_v3_driver.NsxV3Driver(mock.MagicMock())
|
||||
# fake the callback invoked after init
|
||||
registry.notify(resources.PROCESS, events.BEFORE_SPAWN,
|
||||
mock.MagicMock())
|
||||
registry.publish(resources.PROCESS, events.BEFORE_SPAWN,
|
||||
mock.MagicMock())
|
||||
l2gws = self.driver._get_l2_gateways(self.context)
|
||||
# Verify whether only one default L2 gateway is created
|
||||
self.assertEqual(1, len(l2gws))
|
||||
|
Loading…
Reference in New Issue
Block a user