Replace messaging.get_transport with get_rpc_transport

The get_transport method was deprecated in the oslo.messaging
5.24.2 release in favor of get_rpc_transport and
get_notification_transport. We are already using get_notification_transport,
we just need to change to use get_rpc_transport.

Change-Id: Ie276fedef35f411cafbaf25c2148fea42ae01410
This commit is contained in:
Matt Riedemann 2017-06-05 15:05:29 -04:00
parent 78c69f61ab
commit a59e2b196a
6 changed files with 10 additions and 8 deletions

View File

@ -121,7 +121,8 @@ 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)
transport = messaging.get_rpc_transport(
nova.conf.CONF, transport_url)
self.transports[transport_url] = transport
else:
transport = self.transports[transport_url]

View File

@ -230,9 +230,9 @@ def if_notifications_enabled(f):
def create_transport(url):
exmods = get_allowed_exmods()
return messaging.get_transport(CONF,
url=url,
allowed_remote_exmods=exmods)
return messaging.get_rpc_transport(CONF,
url=url,
allowed_remote_exmods=exmods)
class LegacyValidatingNotifier(object):

View File

@ -671,7 +671,7 @@ class RPCFixture(fixtures.Fixture):
# one of the many transports we're multplexing here.
if url not in self._buses:
exmods = rpc.get_allowed_exmods()
self._buses[url] = messaging.get_transport(
self._buses[url] = messaging.get_rpc_transport(
CONF,
url=url,
allowed_remote_exmods=exmods)

View File

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

View File

@ -21,7 +21,7 @@ from nova import test
class TestNotifier(test.NoDBTestCase):
@mock.patch('oslo_messaging.get_transport')
@mock.patch('oslo_messaging.get_rpc_transport')
@mock.patch('oslo_messaging.get_notification_transport')
@mock.patch('oslo_messaging.Notifier')
def test_notification_format_affects_notification_driver(self,

View File

@ -304,7 +304,7 @@ class TestRPC(testtools.TestCase):
self.assertEqual('notifier', notifier)
@mock.patch.object(rpc, 'get_allowed_exmods')
@mock.patch.object(messaging, 'get_transport')
@mock.patch.object(messaging, 'get_rpc_transport')
def test_create_transport(self, mock_transport, mock_exmods):
exmods = mock_exmods.return_value
transport = rpc.create_transport(mock.sentinel.url)