From 077e869fda6b8ba271dd8f791923a67375d1a359 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 15 Oct 2015 15:44:03 +0200 Subject: [PATCH] Deprecate new= argument from create_connection 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 | 2 +- neutron/common/rpc.py | 4 +++- neutron/plugins/brocade/NeutronPlugin.py | 2 +- neutron/plugins/ml2/plugin.py | 2 +- neutron/services/l3_router/l3_router_plugin.py | 2 +- neutron/services/metering/metering_plugin.py | 2 +- neutron/tests/unit/agent/test_rpc.py | 6 +++--- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index 7a8de697be4..fa93b362ba0 100644 --- a/neutron/agent/rpc.py +++ b/neutron/agent/rpc.py @@ -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) diff --git a/neutron/common/rpc.py b/neutron/common/rpc.py index 3037f5342f0..f4b7475f096 100644 --- a/neutron/common/rpc.py +++ b/neutron/common/rpc.py @@ -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 diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 306f84a28ae..d44842c9a18 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -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(), diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index ae8c3f181f8..622d012bfc4 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -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()], diff --git a/neutron/services/l3_router/l3_router_plugin.py b/neutron/services/l3_router/l3_router_plugin.py index cca550d2b9c..1579efb55cc 100644 --- a/neutron/services/l3_router/l3_router_plugin.py +++ b/neutron/services/l3_router/l3_router_plugin.py @@ -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()] diff --git a/neutron/services/metering/metering_plugin.py b/neutron/services/metering/metering_plugin.py index 6cbbabd47af..11a928642a0 100644 --- a/neutron/services/metering/metering_plugin.py +++ b/neutron/services/metering/metering_plugin.py @@ -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() diff --git a/neutron/tests/unit/agent/test_rpc.py b/neutron/tests/unit/agent/test_rpc.py index 2be1cb80068..9435b3ed85c 100644 --- a/neutron/tests/unit/agent/test_rpc.py +++ b/neutron/tests/unit/agent/test_rpc.py @@ -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,