]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Renamed start_rpc_listener -> start_rpc_listeners
authorIhar Hrachyshka <ihrachys@redhat.com>
Mon, 9 Jun 2014 12:32:05 +0000 (14:32 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Thu, 19 Jun 2014 10:58:01 +0000 (12:58 +0200)
Now that we explicitly start multiple RPC servers, renamed the method to
reflect behaviour.

blueprint oslo-messaging

Change-Id: I7c51cc1b44b4b4c8899255b9bedce1792c38634e

neutron/neutron_plugin_base_v2.py
neutron/plugins/metaplugin/meta_neutron_plugin.py
neutron/plugins/ml2/plugin.py
neutron/service.py
neutron/tests/unit/metaplugin/fake_plugin.py
neutron/tests/unit/metaplugin/test_metaplugin.py
neutron/tests/unit/ml2/test_port_binding.py
neutron/tests/unit/ml2/test_security_group.py

index 67bd581c82f71a3add00e5d52976f89ce2737568..8c0c7804dceea3a395ed5ed51a6f8231c127ebe9 100644 (file)
@@ -324,10 +324,10 @@ class NeutronPluginBaseV2(object):
         """
         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.
 
@@ -340,13 +340,13 @@ class NeutronPluginBaseV2(object):
         """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)
index 1a2686f37193f0c10d76eac2cf522b25c0ee6e27..92a962846d1dcfa2f7d9ea464c66b1dbbcdacea7 100644 (file)
@@ -203,8 +203,8 @@ class MetaPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
         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
index 04f8df24a092751cd6bd8cfa6e5d13673b7186f0..aab9b8b8911f290076138ba0bd467b4df350c889 100644 (file)
@@ -125,7 +125,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
             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)
index f14021769e85b1bbdb72084e6716ddf915493d22..c26182bc5db19f67d6be2636bcf0c8e4f06b126c 100644 (file)
@@ -119,7 +119,7 @@ class RpcWorker(object):
         # 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:
@@ -136,14 +136,14 @@ class RpcWorker(object):
 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
index df3dc75fbcdae919feedde53699f221a8452f163..1430697f31494c8f933c84cc21bc84877de37908 100644 (file)
@@ -74,6 +74,6 @@ class Fake2(Fake1):
     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'
index 97346cc0d6ea103a04b461fbea3b7a90c647dfcc..7dc621978db172835d4e4af1b6f3da145820e919 100644 (file)
@@ -400,5 +400,5 @@ class MetaNeutronPluginV2TestRpcFlavor(base.BaseTestCase):
         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)
index 86ff76cb03fd0db710d1a042656441dbff3ff1cb..19523474a2b626fab7075c16ca7b41ae4c7faf90 100644 (file)
@@ -39,7 +39,7 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
         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)
index b0a06fa82193421f4f75e5c1f7e886ab58e1e558..46aba96126d84454d2c08836cf7cf95028d46975 100644 (file)
@@ -53,7 +53,7 @@ class TestMl2SecurityGroups(Ml2SecurityGroupsTestCase,
     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: