]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Deprecate new= argument from create_connection
authorIhar Hrachyshka <ihrachys@redhat.com>
Thu, 15 Oct 2015 13:44:03 +0000 (15:44 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Fri, 6 Nov 2015 12:27:37 +0000 (13:27 +0100)
It's not used since the time we switched to oslo.messaging (Juno), it's
time to deprecate and eventually remove it.

Closes-Bug: #1506492
Change-Id: I57b0229c2b6028796cd10bbbfc9b166cf8a6dab0

neutron/agent/rpc.py
neutron/common/rpc.py
neutron/plugins/brocade/NeutronPlugin.py
neutron/plugins/ml2/plugin.py
neutron/services/l3_router/l3_router_plugin.py
neutron/services/metering/metering_plugin.py
neutron/tests/unit/agent/test_rpc.py

index 7a8de697be4acb921ecf4c9853070d85c4830308..fa93b362ba064e95ddf93e548524ef1359da27ba 100644 (file)
@@ -42,7 +42,7 @@ def create_consumers(endpoints, prefix, topic_details, start_listening=True):
     :returns: A common Connection.
     """
 
-    connection = n_rpc.create_connection(new=True)
+    connection = n_rpc.create_connection()
     for details in topic_details:
         topic, operation, node_name = itertools.islice(
             itertools.chain(details, [None]), 3)
index 3037f5342f000f8ae1b31e6e4ec12ae318008e14..f4b7475f09658e0f1260f673b26144954e8de3a2 100644 (file)
@@ -14,6 +14,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from debtcollector import removals
 from oslo_config import cfg
 from oslo_log import log as logging
 import oslo_messaging
@@ -157,7 +158,7 @@ class Service(service.Service):
     def start(self):
         super(Service, self).start()
 
-        self.conn = create_connection(new=True)
+        self.conn = create_connection()
         LOG.debug("Creating Consumer connection for Service %s",
                   self.topic)
 
@@ -220,6 +221,7 @@ class VoidConnection(object):
 
 
 # functions
+@removals.removed_kwarg('new')
 def create_connection(new=True):
     # NOTE(salv-orlando): This is a clever interpreation of the factory design
     # patter aimed at preventing plugins from initializing RPC servers upon
index 306f84a28aec5e6e02f305de0003fbd3f66a9047..d44842c9a18450b21f34d9105e0fe4cfaf47658f 100644 (file)
@@ -254,7 +254,7 @@ class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
                                svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
         self.rpc_context = n_context.ContextBase('neutron', 'neutron',
                                                  is_admin=False)
-        self.conn = n_rpc.create_connection(new=True)
+        self.conn = n_rpc.create_connection()
         self.endpoints = [BridgeRpcCallbacks(),
                           securitygroups_rpc.SecurityGroupServerRpcCallback(),
                           dhcp_rpc.DhcpRpcCallback(),
index ae8c3f181f830dbd1e714a53f1628a98b31316d0..622d012bfc44ca10987816d76b3c7589463de554 100644 (file)
@@ -188,7 +188,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
         """Start the RPC loop to let the plugin communicate with agents."""
         self._setup_rpc()
         self.topic = topics.PLUGIN
-        self.conn = n_rpc.create_connection(new=True)
+        self.conn = n_rpc.create_connection()
         self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
         self.conn.create_consumer(topics.REPORTS,
                                   [agents_db.AgentExtRpcCallback()],
index cca550d2b9c97a7a3f8f29bfbf1e570c61c28b55..1579efb55cc40810e709aa3308f123af9971ec02 100644 (file)
@@ -71,7 +71,7 @@ class L3RouterPlugin(service_base.ServicePluginBase,
     def start_rpc_listeners(self):
         # RPC support
         self.topic = topics.L3PLUGIN
-        self.conn = n_rpc.create_connection(new=True)
+        self.conn = n_rpc.create_connection()
         self.agent_notifiers.update(
             {n_const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotifyAPI()})
         self.endpoints = [l3_rpc.L3RpcCallback()]
index 6cbbabd47af3d2202f9db404b5fb30df71e49087..11a928642a0a2fbfc862d38094e3bda27fadc09b 100644 (file)
@@ -32,7 +32,7 @@ class MeteringPlugin(metering_db.MeteringDbMixin):
 
     def start_rpc_listeners(self):
         self.endpoints = [metering_rpc.MeteringRpcCallbacks(self)]
-        self.conn = n_rpc.create_connection(new=True)
+        self.conn = n_rpc.create_connection()
         self.conn.create_consumer(
             topics.METERING_PLUGIN, self.endpoints, fanout=False)
         return self.conn.consume_in_threads()
index 2be1cb80068000d5026ff0be22c4a9a7b5322694..9435b3ed85ca12bcbd376d7cbefe9cb710bddec9 100644 (file)
@@ -136,7 +136,7 @@ class AgentRPCMethods(base.BaseTestCase):
     def test_create_consumers_start_listening(self):
         endpoints = [mock.Mock()]
         expected = [
-            mock.call(new=True),
+            mock.call(),
             mock.call().create_consumer('foo-topic-op', endpoints,
                                         fanout=True),
             mock.call().consume_in_threads()
@@ -149,7 +149,7 @@ class AgentRPCMethods(base.BaseTestCase):
     def test_create_consumers_do_not_listen(self):
         endpoints = [mock.Mock()]
         expected = [
-            mock.call(new=True),
+            mock.call(),
             mock.call().create_consumer('foo-topic-op', endpoints,
                                         fanout=True),
         ]
@@ -161,7 +161,7 @@ class AgentRPCMethods(base.BaseTestCase):
     def test_create_consumers_with_node_name(self):
         endpoints = [mock.Mock()]
         expected = [
-            mock.call(new=True),
+            mock.call(),
             mock.call().create_consumer('foo-topic-op', endpoints,
                                         fanout=True),
             mock.call().create_consumer('foo-topic-op.node1', endpoints,