diff options
| author | Sandy Walsh <sandy@sandywalsh.com> | 2012-02-07 20:59:04 -0800 |
|---|---|---|
| committer | Sandy Walsh <sandy@sandywalsh.com> | 2012-02-21 12:03:08 -0800 |
| commit | 8d758d4dbe194b4608af34c3ca6520d620d3cdc3 (patch) | |
| tree | 2b8df65807a472263c278cdbeffce8d3941450eb /nova/notifier | |
| parent | adaf9049c8fb3652c0962909a3c835e1724d8a17 (diff) | |
Scheduler notifications added.
Re-added lost fake virt hypervisor info (required for local dev).
Added multiple exchange topic support to RabbitNotifier.
Change-Id: I33cc9076ee35061c21852cabba3275006fc87b86
Diffstat (limited to 'nova/notifier')
| -rw-r--r-- | nova/notifier/rabbit_notifier.py | 15 |
1 files changed, 10 insertions, 5 deletions
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())) |
