Merge "Use get_notification_transport for notifications"

This commit is contained in:
Jenkins 2017-06-01 18:29:06 +00:00 committed by Gerrit Code Review
commit ded53681cb

View File

@ -35,6 +35,7 @@ import manila.exception
CONF = cfg.CONF CONF = cfg.CONF
TRANSPORT = None TRANSPORT = None
NOTIFICATION_TRANSPORT = None
NOTIFIER = None NOTIFIER = None
ALLOWED_EXMODS = [ ALLOWED_EXMODS = [
@ -44,13 +45,17 @@ EXTRA_EXMODS = []
def init(conf): def init(conf):
global TRANSPORT, NOTIFIER global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
exmods = get_allowed_exmods() exmods = get_allowed_exmods()
TRANSPORT = messaging.get_transport(conf, TRANSPORT = messaging.get_transport(conf,
allowed_remote_exmods=exmods) allowed_remote_exmods=exmods)
NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
conf,
allowed_remote_exmods=exmods)
serializer = RequestContextSerializer(JsonPayloadSerializer()) serializer = RequestContextSerializer(JsonPayloadSerializer())
NOTIFIER = messaging.Notifier(TRANSPORT, serializer=serializer) NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
serializer=serializer)
def initialized(): def initialized():
@ -58,11 +63,13 @@ def initialized():
def cleanup(): def cleanup():
global TRANSPORT, NOTIFIER global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
assert TRANSPORT is not None assert TRANSPORT is not None
assert NOTIFICATION_TRANSPORT is not None
assert NOTIFIER is not None assert NOTIFIER is not None
TRANSPORT.cleanup() TRANSPORT.cleanup()
TRANSPORT = NOTIFIER = None NOTIFICATION_TRANSPORT.cleanup()
TRANSPORT = NOTIFIER = NOTIFICATION_TRANSPORT = None
def set_defaults(control_exchange): def set_defaults(control_exchange):