From 1dcdf38bc207e54cca234788b144afb0da27b4e9 Mon Sep 17 00:00:00 2001 From: wangjun Date: Tue, 5 Dec 2017 09:40:53 +0800 Subject: [PATCH] Add functionality to define different Message and Notification destination Sometime,huge notification messages will effect the rabbitMQ cluster's performance.This commit adds functionality do define different Message and Notification destination. Closes-Bug: #1734823 Change-Id: I2ef4d008c9ca91a03d8c7e1380e0188bf6792595 --- etc/trove/trove-conductor.conf.sample | 28 +++++++++++++++++++++++++ etc/trove/trove-guestagent.conf.sample | 28 +++++++++++++++++++++++++ etc/trove/trove-taskmanager.conf.sample | 28 +++++++++++++++++++++++++ etc/trove/trove.conf.sample | 28 +++++++++++++++++++++++++ trove/rpc.py | 16 ++++++++++---- 5 files changed, 124 insertions(+), 4 deletions(-) diff --git a/etc/trove/trove-conductor.conf.sample b/etc/trove/trove-conductor.conf.sample index 6249ed2ebd..d858bf254b 100644 --- a/etc/trove/trove-conductor.conf.sample +++ b/etc/trove/trove-conductor.conf.sample @@ -29,6 +29,34 @@ control_exchange = trove [database] connection = mysql+pymysql://root:e1a2c042c828d3566d0a@localhost/trove +[oslo_messaging_notifications] + +# +# From oslo.messaging +# + +# The Driver(s) to handle sending notifications. Possible +# values are messaging, messagingv2, routing, log, test, noop +# (multi valued) +# Deprecated group/name - [DEFAULT]/notification_driver +#driver = + +# A URL representing the messaging driver to use for +# notifications. If not set, we fall back to the same +# configuration used for RPC. (string value) +# Deprecated group/name - [DEFAULT]/notification_transport_url +#transport_url = + +# AMQP topic used for OpenStack notifications. (list value) +# Deprecated group/name - [rpc_notifier2]/topics +# Deprecated group/name - [DEFAULT]/notification_topics +#topics = notifications + +# The maximum number of attempts to re-send a notification +# message which failed to be delivered due to a recoverable +# error. 0 - No retry, -1 - indefinite (integer value) +#retry = -1 + [oslo_messaging_rabbit] # The RabbitMQ broker address where a single node is used. (string value) # Deprecated group/name - [DEFAULT]/rabbit_host diff --git a/etc/trove/trove-guestagent.conf.sample b/etc/trove/trove-guestagent.conf.sample index 9d52a465e7..756e9ef2c4 100644 --- a/etc/trove/trove-guestagent.conf.sample +++ b/etc/trove/trove-guestagent.conf.sample @@ -82,6 +82,34 @@ log_config_append = /etc/trove/trove-logging-guestagent.conf # If False doesn't trace SQL requests. #trace_sqlalchemy = True +[oslo_messaging_notifications] + +# +# From oslo.messaging +# + +# The Driver(s) to handle sending notifications. Possible +# values are messaging, messagingv2, routing, log, test, noop +# (multi valued) +# Deprecated group/name - [DEFAULT]/notification_driver +#driver = + +# A URL representing the messaging driver to use for +# notifications. If not set, we fall back to the same +# configuration used for RPC. (string value) +# Deprecated group/name - [DEFAULT]/notification_transport_url +#transport_url = + +# AMQP topic used for OpenStack notifications. (list value) +# Deprecated group/name - [rpc_notifier2]/topics +# Deprecated group/name - [DEFAULT]/notification_topics +#topics = notifications + +# The maximum number of attempts to re-send a notification +# message which failed to be delivered due to a recoverable +# error. 0 - No retry, -1 - indefinite (integer value) +#retry = -1 + [oslo_messaging_rabbit] # The RabbitMQ broker address where a single node is used. (string value) # Deprecated group/name - [DEFAULT]/rabbit_host diff --git a/etc/trove/trove-taskmanager.conf.sample b/etc/trove/trove-taskmanager.conf.sample index 7751288792..a0d96bdb8b 100644 --- a/etc/trove/trove-taskmanager.conf.sample +++ b/etc/trove/trove-taskmanager.conf.sample @@ -185,6 +185,34 @@ idle_timeout = 3600 # If False doesn't trace SQL requests. #trace_sqlalchemy = True +[oslo_messaging_notifications] + +# +# From oslo.messaging +# + +# The Driver(s) to handle sending notifications. Possible +# values are messaging, messagingv2, routing, log, test, noop +# (multi valued) +# Deprecated group/name - [DEFAULT]/notification_driver +#driver = + +# A URL representing the messaging driver to use for +# notifications. If not set, we fall back to the same +# configuration used for RPC. (string value) +# Deprecated group/name - [DEFAULT]/notification_transport_url +#transport_url = + +# AMQP topic used for OpenStack notifications. (list value) +# Deprecated group/name - [rpc_notifier2]/topics +# Deprecated group/name - [DEFAULT]/notification_topics +#topics = notifications + +# The maximum number of attempts to re-send a notification +# message which failed to be delivered due to a recoverable +# error. 0 - No retry, -1 - indefinite (integer value) +#retry = -1 + [oslo_messaging_rabbit] # The RabbitMQ broker address where a single node is used. (string value) # Deprecated group/name - [DEFAULT]/rabbit_host diff --git a/etc/trove/trove.conf.sample b/etc/trove/trove.conf.sample index 2b88d41e4a..27d65f53fb 100644 --- a/etc/trove/trove.conf.sample +++ b/etc/trove/trove.conf.sample @@ -179,6 +179,34 @@ idle_timeout = 3600 #optional: #ca_file = /path/to/ca_file +[oslo_messaging_notifications] + +# +# From oslo.messaging +# + +# The Driver(s) to handle sending notifications. Possible +# values are messaging, messagingv2, routing, log, test, noop +# (multi valued) +# Deprecated group/name - [DEFAULT]/notification_driver +#driver = + +# A URL representing the messaging driver to use for +# notifications. If not set, we fall back to the same +# configuration used for RPC. (string value) +# Deprecated group/name - [DEFAULT]/notification_transport_url +#transport_url = + +# AMQP topic used for OpenStack notifications. (list value) +# Deprecated group/name - [rpc_notifier2]/topics +# Deprecated group/name - [DEFAULT]/notification_topics +#topics = notifications + +# The maximum number of attempts to re-send a notification +# message which failed to be delivered due to a recoverable +# error. 0 - No retry, -1 - indefinite (integer value) +#retry = -1 + [oslo_messaging_rabbit] # The RabbitMQ broker address where a single node is used. (string value) # Deprecated group/name - [DEFAULT]/rabbit_host diff --git a/trove/rpc.py b/trove/rpc.py index c2e419edd6..81a9b2fbe4 100644 --- a/trove/rpc.py +++ b/trove/rpc.py @@ -39,6 +39,7 @@ from trove.common.rpc import serializer as sz CONF = cfg.CONF TRANSPORT = None +NOTIFICATION_TRANSPORT = None NOTIFIER = None ALLOWED_EXMODS = [ @@ -49,22 +50,29 @@ EXTRA_EXMODS = [] def init(conf): - global TRANSPORT, NOTIFIER + global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER exmods = get_allowed_exmods() TRANSPORT = messaging.get_rpc_transport(conf, allowed_remote_exmods=exmods) + NOTIFICATION_TRANSPORT = messaging.get_notification_transport( + conf, + allowed_remote_exmods=exmods) + serializer = sz.TroveRequestContextSerializer( 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):