From 1bdb400656193ccb13fc2e2799db1ab7150832ab Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Mon, 4 Apr 2016 18:18:10 +0300 Subject: [PATCH] Use messaging notifications transport instead of default The usage of oslo_messaging.get_transport is not meant for notifications; And oslo_messaging.get_notification_transport is favored for those means. So this change introduces the usage of that function. If the settings for the notifications are not set with the configuration that's under the oslo_messaging_notifications group, this will fall back to the old settings which are under the DEFAULT group; just like this used to work. Change-Id: I1b69e57309df0b6dc675009f42cef34fd501b179 --- cinder/rpc.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cinder/rpc.py b/cinder/rpc.py index a92fc0dd098..3a538233410 100644 --- a/cinder/rpc.py +++ b/cinder/rpc.py @@ -42,6 +42,7 @@ from cinder.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) TRANSPORT = None +NOTIFICATION_TRANSPORT = None NOTIFIER = None ALLOWED_EXMODS = [ @@ -63,14 +64,19 @@ TRANSPORT_ALIASES = { def init(conf): - global TRANSPORT, NOTIFIER + global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER exmods = get_allowed_exmods() TRANSPORT = messaging.get_transport(conf, allowed_remote_exmods=exmods, aliases=TRANSPORT_ALIASES) + NOTIFICATION_TRANSPORT = messaging.get_notification_transport( + conf, + allowed_remote_exmods=exmods, + aliases=TRANSPORT_ALIASES) serializer = RequestContextSerializer(JsonPayloadSerializer()) - NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) + NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT, + serializer=serializer) def initialized(): @@ -78,11 +84,13 @@ def initialized(): def cleanup(): - global TRANSPORT, NOTIFIER + global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER assert TRANSPORT is not None + assert NOTIFICATION_TRANSPORT is not None assert NOTIFIER is not None TRANSPORT.cleanup() - TRANSPORT = NOTIFIER = None + NOTIFICATION_TRANSPORT.cleanup() + TRANSPORT = NOTIFICATION_TRANSPORT = NOTIFIER = None def set_defaults(control_exchange):