"""
pass
- def start_rpc_listener(self):
- """Start the rpc listener.
+ def start_rpc_listeners(self):
+ """Start the RPC listeners.
- Most plugins start an RPC listener implicitly on initialization. In
+ Most plugins start RPC listeners implicitly on initialization. In
order to support multiple process RPC, the plugin needs to expose
control over when this is started.
"""Return whether the plugin supports multiple RPC workers.
A plugin that supports multiple RPC workers should override the
- start_rpc_listener method to ensure that this method returns True and
- that start_rpc_listener is called at the appropriate time.
+ start_rpc_listeners method to ensure that this method returns True and
+ that start_rpc_listeners is called at the appropriate time.
Alternately, a plugin can override this method to customize detection
of support for multiple rpc workers
.. note:: this method is optional, as it was not part of the originally
defined plugin API.
"""
- return (self.__class__.start_rpc_listener !=
- NeutronPluginBaseV2.start_rpc_listener)
+ return (self.__class__.start_rpc_listeners !=
+ NeutronPluginBaseV2.start_rpc_listeners)
flavor = self._get_flavor_by_network_id(context, network['id'])
network[ext_flavor.FLAVOR_NETWORK] = flavor
- def start_rpc_listener(self):
- return self.plugins[self.rpc_flavor].start_rpc_listener()
+ def start_rpc_listeners(self):
+ return self.plugins[self.rpc_flavor].start_rpc_listeners()
def rpc_workers_supported(self):
#NOTE: If a plugin which supports multiple RPC workers is desired
dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
)
- def start_rpc_listener(self):
+ def start_rpc_listeners(self):
self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager)
self.topic = topics.PLUGIN
self.conn = rpc_compat.create_connection(new=True)
# existing sql connections avoids producing errors later when they are
# discovered to be broken.
session.get_engine().pool.dispose()
- self._servers = self._plugin.start_rpc_listener()
+ self._servers = self._plugin.start_rpc_listeners()
def wait(self):
for server in self._servers:
def serve_rpc():
plugin = manager.NeutronManager.get_plugin()
- # If 0 < rpc_workers then start_rpc_listener would be called in a
+ # If 0 < rpc_workers then start_rpc_listeners would be called in a
# subprocess and we cannot simply catch the NotImplementedError. It is
# simpler to check this up front by testing whether the plugin supports
# multiple RPC workers.
if not plugin.rpc_workers_supported():
- LOG.debug(_("Active plugin doesn't implement start_rpc_listener"))
+ LOG.debug(_("Active plugin doesn't implement start_rpc_listeners"))
if 0 < cfg.CONF.rpc_workers:
- msg = _("'rpc_workers = %d' ignored because start_rpc_listener "
+ msg = _("'rpc_workers = %d' ignored because start_rpc_listeners "
"is not implemented.")
LOG.error(msg, cfg.CONF.rpc_workers)
raise NotImplementedError
def fake_func2(self):
return 'fake2'
- def start_rpc_listener(self):
+ def start_rpc_listeners(self):
# return value is only used to confirm this method was called.
return 'OK'
self.assertEqual(topics.PLUGIN, 'q-plugin')
ret = self.plugin.rpc_workers_supported()
self.assertTrue(ret)
- ret = self.plugin.start_rpc_listener()
+ ret = self.plugin.start_rpc_listeners()
self.assertEqual('OK', ret)
super(PortBindingTestCase, self).setUp(PLUGIN_NAME)
self.port_create_status = 'DOWN'
self.plugin = manager.NeutronManager.get_plugin()
- self.plugin.start_rpc_listener()
+ self.plugin.start_rpc_listeners()
def _check_response(self, port, vif_type, has_port_filter, bound, status):
self.assertEqual(port[portbindings.VIF_TYPE], vif_type)
def setUp(self):
super(TestMl2SecurityGroups, self).setUp()
plugin = manager.NeutronManager.get_plugin()
- plugin.start_rpc_listener()
+ plugin.start_rpc_listeners()
def test_security_group_get_port_from_device(self):
with self.network() as n: