From 5d349c69a086ae5b698f29c52aed2f5c530d474d Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Mon, 30 May 2016 09:05:13 +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: Ic72fd658fe9b35d39cc3d7da2e4b9fe3454edfba --- ironic/common/rpc.py | 14 +++++++++++--- .../configure-notifications-72824356e7d8832a.yaml | 8 ++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/configure-notifications-72824356e7d8832a.yaml diff --git a/ironic/common/rpc.py b/ironic/common/rpc.py index 212bec699c..7c02be69b0 100644 --- a/ironic/common/rpc.py +++ b/ironic/common/rpc.py @@ -22,6 +22,7 @@ from ironic.common import exception CONF = cfg.CONF TRANSPORT = None +NOTIFICATION_TRANSPORT = None NOTIFIER = None ALLOWED_EXMODS = [ @@ -47,16 +48,23 @@ def init(conf): 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(messaging.JsonPayloadSerializer()) - NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) + NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT, + serializer=serializer) 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): diff --git a/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml b/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml new file mode 100644 index 0000000000..c3ba116469 --- /dev/null +++ b/releasenotes/notes/configure-notifications-72824356e7d8832a.yaml @@ -0,0 +1,8 @@ +--- +features: + - It is now possible to configure the notifications tu use a different + transport URL than the RPCs. These could potentially be completely + different message broker hosts (though they don't need to be). If the + notification-specific configuration is not provided, the notifier will use + the same transport as the RPCs. +