Use get_rpc_transport instead of get_transport

With the added get_rpc_transport() function in oslo.messaging [1]
and the recent version bump of oslo.messaging to 5.24.2, we can
safely replace get_transport() with get_rpc_transport() which is much
cleaner.

[1] https://review.openstack.org/#/c/454194/

Change-Id: I460bdcae7855cae189d9b61896b5ef78989a197e
This commit is contained in:
deepakmourya 2017-06-07 12:44:45 +05:30
parent 43334cea47
commit d748264866
2 changed files with 6 additions and 8 deletions

View File

@ -59,9 +59,8 @@ TRANSPORT_ALIASES = {
def init(conf):
global TRANSPORT, NOTIFIER
exmods = get_allowed_exmods()
TRANSPORT = messaging.get_transport(conf,
allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES)
TRANSPORT = messaging.get_rpc_transport(conf,
allowed_remote_exmods=exmods)
serializer = RequestContextSerializer(JsonPayloadSerializer())
NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer)

View File

@ -68,8 +68,8 @@ class Service(object):
def __init__(self, topic, server, handlers):
serializer = RequestContextSerializer(
objects_base.CloudpulseObjectSerializer())
transport = messaging.get_transport(cfg.CONF,
aliases=TRANSPORT_ALIASES)
transport = messaging.get_rpc_transport(cfg.CONF,
aliases=TRANSPORT_ALIASES)
# TODO(asalkeld) add support for version='x.y'
target = messaging.Target(topic=topic, server=server)
self._server = messaging.get_rpc_server(transport, target, handlers,
@ -87,9 +87,8 @@ class API(object):
objects_base.CloudpulseObjectSerializer())
if transport is None:
exmods = rpc.get_allowed_exmods()
transport = messaging.get_transport(cfg.CONF,
allowed_remote_exmods=exmods,
aliases=TRANSPORT_ALIASES)
transport = messaging.get_rpc_transport(
cfg.CONF, allowed_remote_exmods=exmods)
self._context = context
if topic is None:
topic = ''