Merge "use new payload objects for *_INIT callbacks"
This commit is contained in:
commit
7a6fa74208
neutron
plugins/ml2/drivers/agent
services
tests/unit/plugins/ml2/drivers/agent
@ -17,7 +17,7 @@ from neutron_lib.callbacks import registry
|
||||
|
||||
def notify_init_event(agent_type, agent):
|
||||
"""Notify init event for the specified agent."""
|
||||
registry.notify(agent_type, events.AFTER_INIT, agent, agent=agent)
|
||||
registry.publish(agent_type, events.AFTER_INIT, agent)
|
||||
|
||||
|
||||
def register(callback, agent_type):
|
||||
|
@ -48,7 +48,7 @@ class DriverBase(object):
|
||||
# logging plugin can discover which resources types are supported by
|
||||
# the log driver.
|
||||
@registry.receives(log_const.LOGGING_PLUGIN, [events.AFTER_INIT])
|
||||
def _register(self, resource, event, trigger, **kwargs):
|
||||
def _register(self, resource, event, trigger, payload=None):
|
||||
if self.is_loaded:
|
||||
# trigger is the LoggingServiceDriverManager
|
||||
trigger.register_driver(self)
|
||||
|
@ -26,7 +26,7 @@ class LoggingServiceDriverManager(object):
|
||||
|
||||
def __init__(self):
|
||||
self._drivers = set()
|
||||
registry.notify(log_const.LOGGING_PLUGIN, events.AFTER_INIT, self)
|
||||
registry.publish(log_const.LOGGING_PLUGIN, events.AFTER_INIT, self)
|
||||
|
||||
@property
|
||||
def drivers(self):
|
||||
|
@ -43,7 +43,7 @@ class QosServiceDriverManager(object):
|
||||
# notify any registered QoS driver that we're ready, those will
|
||||
# call the driver manager back with register_driver if they
|
||||
# are enabled
|
||||
registry.notify(qos_consts.QOS_PLUGIN, events.AFTER_INIT, self)
|
||||
registry.publish(qos_consts.QOS_PLUGIN, events.AFTER_INIT, self)
|
||||
|
||||
if self.rpc_notifications_required:
|
||||
self.push_api = resources_rpc.ResourcesPushRpcApi()
|
||||
|
@ -62,7 +62,7 @@ class DriverBase(object):
|
||||
return agent_type == self.agent_type
|
||||
|
||||
@registry.receives(trunk_consts.TRUNK_PLUGIN, [events.AFTER_INIT])
|
||||
def register(self, resource, event, trigger, **kwargs):
|
||||
def register(self, resource, event, trigger, payload=None):
|
||||
"""Register the trunk driver.
|
||||
|
||||
This method should be overridden so that the driver can subscribe
|
||||
|
@ -60,7 +60,7 @@ class TrunkPlugin(service_base.ServicePluginBase,
|
||||
drivers.register()
|
||||
registry.subscribe(rules.enforce_port_deletion_rules,
|
||||
resources.PORT, events.BEFORE_DELETE)
|
||||
registry.notify(constants.TRUNK_PLUGIN, events.AFTER_INIT, self)
|
||||
registry.publish(constants.TRUNK_PLUGIN, events.AFTER_INIT, self)
|
||||
for driver in self._drivers:
|
||||
LOG.debug('Trunk plugin loaded with driver %s', driver.name)
|
||||
self.check_compatibility()
|
||||
|
@ -31,10 +31,10 @@ class CapabilitiesTest(base.BaseTestCase):
|
||||
mock_agent_type = mock.Mock()
|
||||
mock_agent = mock.Mock()
|
||||
capabilities.notify_init_event(mock_agent_type, mock_agent)
|
||||
self._mgr.notify.assert_called_with(mock_agent_type,
|
||||
self._mgr.publish.assert_called_with(mock_agent_type,
|
||||
events.AFTER_INIT,
|
||||
mock_agent,
|
||||
agent=mock_agent)
|
||||
payload=None)
|
||||
|
||||
def test_register(self):
|
||||
mock_callback = mock.Mock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user