Skip to content

Commit

Permalink
Add rabbit_durable_queues config option.
Browse files Browse the repository at this point in the history
Fixes bug 1054183

Avoid AMQPChannelException: (406, "PRECONDITION_FAILED...") failures
due to a mismatch between the durability of rabbitmq exchange/queue
declared by glance and ceilometer.

Change-Id: I4e25986a1f503782e701aa1168c4eb231ff25d06
  • Loading branch information
Eoghan Glynn committed Sep 21, 2012
1 parent 7b84172 commit 5268d6b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions doc/source/configuring.rst
Expand Up @@ -795,6 +795,12 @@ Optional. Default: ``30``
Maximum seconds to wait before reconnecting on failures when using
``rabbit`` strategy.

* ``rabbit_durable_queues``

Optional. Default: ``False``

Controls durability of exchange and queue when using ``rabbit`` strategy.

* ``qpid_notification_exchange``

Optional. Default: ``glance``
Expand Down
1 change: 1 addition & 0 deletions etc/glance-api.conf
Expand Up @@ -149,6 +149,7 @@ rabbit_password = guest
rabbit_virtual_host = /
rabbit_notification_exchange = glance
rabbit_notification_topic = glance_notifications
rabbit_durable_queues = False

# Configuration options if sending notifications via Qpid (these are
# the defaults)
Expand Down
8 changes: 5 additions & 3 deletions glance/notifier/notify_kombu.py
Expand Up @@ -38,8 +38,9 @@
default='glance_notifications'),
cfg.StrOpt('rabbit_max_retries', default=0),
cfg.StrOpt('rabbit_retry_backoff', default=2),
cfg.StrOpt('rabbit_retry_max_backoff', default=30)
]
cfg.StrOpt('rabbit_retry_max_backoff', default=30),
cfg.StrOpt('rabbit_durable_queues', default=False),
]

CONF = cfg.CONF
CONF.register_opts(rabbit_opts)
Expand Down Expand Up @@ -103,6 +104,7 @@ def _connect(self):
self.exchange = kombu.entity.Exchange(
channel=self.channel,
type="topic",
durable=CONF.rabbit_durable_queues,
name=CONF.rabbit_notification_exchange)

# NOTE(jerdfelt): Normally the consumer would create the queues,
Expand All @@ -113,7 +115,7 @@ def _connect(self):
queue = kombu.entity.Queue(
channel=self.channel,
exchange=self.exchange,
durable=True,
durable=CONF.rabbit_durable_queues,
name=routing_key,
routing_key=routing_key)
queue.declare()
Expand Down

0 comments on commit 5268d6b

Please sign in to comment.