Remove old oslo.messaging transport aliases

Those are remnants from the oslo-incubator times. Also, oslo.messaging
deprecated [1] transport aliases since 5.2.0+ that is the minimal
version supported for stable/newton. The patch that bumped the minimal
version for Nova landed 3 months+ ago, so we can proceed ripping
those aliases from the code base.

[1] I314cefa5fb1803fa7e21e3e34300e5ced31bba89

Change-Id: Id8c0bc6733e930803b8e9fcf42a9a1f81dcbb356
Closes-Bug: #1424728
changes/90/446990/1
ChangBo Guo(gcb) 6 years ago
parent abb33a4577
commit 05c50f2479
  1. 3
      nova/cells/rpc_driver.py
  2. 20
      nova/rpc.py
  3. 3
      nova/tests/fixtures.py
  4. 3
      nova/tests/unit/cells/test_cells_rpc_driver.py
  5. 9
      nova/tests/unit/test_rpc.py

@ -121,8 +121,7 @@ class InterCellRPCAPI(object):
"""
transport_url = next_hop.db_info['transport_url']
if transport_url not in self.transports:
transport = messaging.get_transport(nova.conf.CONF, transport_url,
rpc.TRANSPORT_ALIASES)
transport = messaging.get_transport(nova.conf.CONF, transport_url)
self.transports[transport_url] = transport
else:
transport = self.transports[transport_url]

@ -23,7 +23,6 @@ __all__ = [
'get_client',
'get_server',
'get_notifier',
'TRANSPORT_ALIASES',
]
import functools
@ -57,25 +56,13 @@ ALLOWED_EXMODS = [
]
EXTRA_EXMODS = []
# NOTE(markmc): The nova.openstack.common.rpc entries are for backwards compat
# with Havana rpc_backend configuration values. The nova.rpc entries are for
# compat with Essex values.
TRANSPORT_ALIASES = {
'nova.openstack.common.rpc.impl_kombu': 'rabbit',
'nova.openstack.common.rpc.impl_qpid': 'qpid',
'nova.openstack.common.rpc.impl_zmq': 'zmq',
'nova.rpc.impl_kombu': 'rabbit',
'nova.rpc.impl_qpid': 'qpid',
'nova.rpc.impl_zmq': 'zmq',
}
def init(conf):
global TRANSPORT, NOTIFICATION_TRANSPORT, LEGACY_NOTIFIER, NOTIFIER
exmods = get_allowed_exmods()
TRANSPORT = create_transport(get_transport_url())
NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
conf, allowed_remote_exmods=exmods, aliases=TRANSPORT_ALIASES)
conf, allowed_remote_exmods=exmods)
serializer = RequestContextSerializer(JsonPayloadSerializer())
if conf.notifications.notification_format == 'unversioned':
LEGACY_NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
@ -182,7 +169,7 @@ class ProfilerRequestContextSerializer(RequestContextSerializer):
def get_transport_url(url_str=None):
return messaging.TransportURL.parse(CONF, url_str, TRANSPORT_ALIASES)
return messaging.TransportURL.parse(CONF, url_str)
def get_client(target, version_cap=None, serializer=None):
@ -232,8 +219,7 @@ def create_transport(url):
exmods = get_allowed_exmods()
return messaging.get_transport(CONF,
url=url,
allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES)
allowed_remote_exmods=exmods)
class LegacyValidatingNotifier(object):

@ -664,8 +664,7 @@ class RPCFixture(fixtures.Fixture):
self._buses[url] = messaging.get_transport(
CONF,
url=url,
allowed_remote_exmods=exmods,
aliases=rpc.TRANSPORT_ALIASES)
allowed_remote_exmods=exmods)
return self._buses[url]
def setUp(self):

@ -89,8 +89,7 @@ class CellsRPCDriverTestCase(test.NoDBTestCase):
# first call to _get_transport creates a oslo.messaging.Transport obj
with mock.patch.object(oslo_messaging, 'get_transport') as get_trans:
transport = rpcapi._get_transport(next_hop)
get_trans.assert_called_once_with(rpc_driver.CONF, transport_url,
rpc.TRANSPORT_ALIASES)
get_trans.assert_called_once_with(rpc_driver.CONF, transport_url)
self.assertIn(transport_url, rpcapi.transports)
self.assertEqual(transport, rpcapi.transports[transport_url])

@ -179,8 +179,7 @@ class TestRPC(testtools.TestCase):
url = rpc.get_transport_url(url_str='bar')
self.assertEqual('foo', url)
mock_url.parse.assert_called_once_with(conf, 'bar',
rpc.TRANSPORT_ALIASES)
mock_url.parse.assert_called_once_with(conf, 'bar')
@mock.patch.object(messaging, 'TransportURL')
def test_get_transport_url_null(self, mock_url):
@ -191,8 +190,7 @@ class TestRPC(testtools.TestCase):
url = rpc.get_transport_url()
self.assertEqual('foo', url)
mock_url.parse.assert_called_once_with(conf, None,
rpc.TRANSPORT_ALIASES)
mock_url.parse.assert_called_once_with(conf, None)
@mock.patch.object(rpc, 'profiler', None)
@mock.patch.object(rpc, 'RequestContextSerializer')
@ -314,8 +312,7 @@ class TestRPC(testtools.TestCase):
mock_exmods.assert_called_once_with()
mock_transport.assert_called_once_with(rpc.CONF,
url=mock.sentinel.url,
allowed_remote_exmods=exmods,
aliases=rpc.TRANSPORT_ALIASES)
allowed_remote_exmods=exmods)
def _test_init(self, mock_notif, mock_noti_trans, mock_ser,
mock_exmods, notif_format, expected_driver_topic_kwargs,

Loading…
Cancel
Save