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
This commit is contained in:
Ihar Hrachyshka 2015-10-15 15:44:03 +02:00
parent d95283a731
commit 077e869fda
7 changed files with 11 additions and 9 deletions

View 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)

View 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

View 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(),

View 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()],

View 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()]

View 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()

View 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,