From 8d758d4dbe194b4608af34c3ca6520d620d3cdc3 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Tue, 7 Feb 2012 20:59:04 -0800 Subject: Scheduler notifications added. Re-added lost fake virt hypervisor info (required for local dev). Added multiple exchange topic support to RabbitNotifier. Change-Id: I33cc9076ee35061c21852cabba3275006fc87b86 --- nova/notifier/rabbit_notifier.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'nova/notifier') diff --git a/nova/notifier/rabbit_notifier.py b/nova/notifier/rabbit_notifier.py index 864e8004d..639fe6784 100644 --- a/nova/notifier/rabbit_notifier.py +++ b/nova/notifier/rabbit_notifier.py @@ -21,9 +21,9 @@ from nova.openstack.common import cfg from nova import rpc -notification_topic_opt = cfg.StrOpt('notification_topic', - default='notifications', - help='RabbitMQ topic used for Nova notifications') +notification_topic_opt = cfg.ListOpt('notification_topics', + default=['notifications', ], + help='AMQP topic used for Nova notifications') FLAGS = flags.FLAGS FLAGS.register_opt(notification_topic_opt) @@ -35,5 +35,10 @@ def notify(message): priority = message.get('priority', FLAGS.default_notification_level) priority = priority.lower() - topic = '%s.%s' % (FLAGS.notification_topic, priority) - rpc.notify(context, topic, message) + for topic in FLAGS.notification_topics: + topic = '%s.%s' % (topic, priority) + try: + rpc.notify(context, topic, message) + except Exception, e: + LOG.exception(_("Could not send notification to %(topic)s. " + "Payload=%(message)s" % locals())) -- cgit