add options to configure messaging

swift does not use oslo.config so we should allow transport
settings to be passed in via paste conf

Change-Id: I686e5d94fb72fd2a00973c91673edc417142ee2f
Closes-Bug: #1417306
This commit is contained in:
gordon chung 2015-02-02 16:01:55 -05:00
parent 468cedc34b
commit 464dbd3b23
1 changed files with 15 additions and 3 deletions

View File

@ -22,11 +22,19 @@ In /etc/swift/proxy-server.conf on the main pipeline add "ceilometer" just
before "proxy-server" and add the following filter in the file:
.. code-block:: python
[filter:ceilometer]
paste.filter_factory = ceilometermiddleware.swift:R
paste.filter_factory = ceilometermiddleware.swift:filter_factory
# Some optional configuration this allow to publish additional metadata
metadata_headers = X-TEST
# Set reseller prefix (defaults to "AUTH_" if not set)
reseller_prefix = AUTH_
# Set control_exchange to publish to.
control_exchange = swift
# Set transport url
transport_url = rabbit://me:passwd@host:5672/virtual_host
# set messaging driver
driver = messaging
# set topic
topic = notifications
"""
import functools
import logging
@ -92,9 +100,13 @@ class Swift(object):
def __init__(self, app, conf):
self._app = app
oslo.messaging.set_transport_defaults(conf.get('control_exchange',
'swift'))
self._notifier = oslo.messaging.Notifier(
oslo.messaging.get_transport(cfg.CONF),
publisher_id='ceilometermiddleware')
oslo.messaging.get_transport(cfg.CONF, url=conf.get('url')),
publisher_id='ceilometermiddleware',
driver=conf.get('driver', 'messaging'),
topic=conf.get('topic', 'notifications'))
self.metadata_headers = [h.strip().replace('-', '_').lower()
for h in conf.get(