notifier: remove notifier_strategy compat support
The notifier_strategy option is deprecated since we merged commit I8cd84772bc5867e06b2a50ed7e15b9e86f0b94ad during the Icehouse cycle. Assuming the usual single cycle deprecation period, this can now be removed. DocImpact: the notifier_strategy has been removed in favor of the notification_driver and related oslo.messaging options. Change-Id: I3ab0133b697a820536e5da84e30b078915a29f6c
This commit is contained in:
parent
4d6e55f40c
commit
b7a9e53190
@ -1136,227 +1136,18 @@ Configuring Notifications
|
||||
-------------------------
|
||||
|
||||
Glance can optionally generate notifications to be logged or sent to
|
||||
a RabbitMQ queue. The configuration options are specified in the
|
||||
a message queue. The configuration options are specified in the
|
||||
``glance-api.conf`` config file in the section ``[DEFAULT]``.
|
||||
|
||||
* ``notifier_strategy``
|
||||
* ``notification_driver``
|
||||
|
||||
Optional. Default: ``noop``
|
||||
|
||||
Sets the strategy used for notifications. Options are ``logging``,
|
||||
``rabbit``, ``qpid`` and ``noop``.
|
||||
For more information :doc:`Glance notifications <notifications>`
|
||||
Sets the notification driver used by oslo.messaging. Options include
|
||||
``messaging``, ``messagingv2``, ``log`` and ``routing``.
|
||||
|
||||
* ``rabbit_host``
|
||||
|
||||
Optional. Default: ``localhost``
|
||||
|
||||
Host to connect to when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_port``
|
||||
|
||||
Optional. Default: ``5672``
|
||||
|
||||
Port to connect to when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_use_ssl``
|
||||
|
||||
Optional. Default: ``false``
|
||||
|
||||
Boolean to use SSL for connecting when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_userid``
|
||||
|
||||
Optional. Default: ``guest``
|
||||
|
||||
Userid to use for connection when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_password``
|
||||
|
||||
Optional. Default: ``guest``
|
||||
|
||||
Password to use for connection when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_virtual_host``
|
||||
|
||||
Optional. Default: ``/``
|
||||
|
||||
Virtual host to use for connection when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_notification_exchange``
|
||||
|
||||
Optional. Default: ``glance``
|
||||
|
||||
Exchange name to use for connection when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_notification_topic``
|
||||
|
||||
Optional. Default: ``notifications``
|
||||
|
||||
Topic to use for connection when using ``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_max_retries``
|
||||
|
||||
Optional. Default: ``0``
|
||||
|
||||
Number of retries on communication failures when using ``rabbit`` strategy.
|
||||
A value of 0 means to retry forever.
|
||||
|
||||
* ``rabbit_retry_backoff``
|
||||
|
||||
Optional. Default: ``2``
|
||||
|
||||
Number of seconds to wait before reconnecting on failures when using
|
||||
``rabbit`` strategy.
|
||||
|
||||
* ``rabbit_retry_max_backoff``
|
||||
|
||||
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``
|
||||
|
||||
Message exchange to use when using the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_notification_topic``
|
||||
|
||||
Optional. Default: ``glanice_notifications``
|
||||
|
||||
This is the topic prefix for notifications when using the ``qpid``
|
||||
notification strategy. When a notification is sent at the ``info`` priority,
|
||||
the topic will be ``notifications.info``. The same idea applies for
|
||||
the ``error`` and ``warn`` notification priorities. To receive all
|
||||
notifications, you would set up a receiver with a topic of
|
||||
``notifications.*``.
|
||||
|
||||
* ``qpid_hostname``
|
||||
|
||||
Optional. Default: ``localhost``
|
||||
|
||||
This is the hostname or IP address of the Qpid broker that will be used
|
||||
when Glance has been configured to use the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_port``
|
||||
|
||||
Optional. Default: ``5672``
|
||||
|
||||
This is the port number to connect to on the Qpid broker, ``qpid_hostname``,
|
||||
when using the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_username``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This is the username that Glance will use to authenticate with the Qpid
|
||||
broker if using the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_password``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This is the username that Glance will use to authenticate with the Qpid
|
||||
broker if using the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_sasl_mechanisms``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This is a space separated list of SASL mechanisms to use for authentication
|
||||
with the Qpid broker if using the ``qpid`` notification strategy.
|
||||
|
||||
* ``qpid_reconnect_timeout``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This option specifies a timeout in seconds for automatic reconnect attempts
|
||||
to the Qpid broker if the ``qpid`` notification strategy is used. In general,
|
||||
it is safe to leave all of the reconnect timing options not set. In that case,
|
||||
the Qpid client's default behavior will be used, which is to attempt to
|
||||
reconnect to the broker at exponential back-off intervals (in 1 second, then 2
|
||||
seconds, then 4, 8, 16, etc).
|
||||
|
||||
* ``qpid_reconnect_limit``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This option specifies a maximum number of reconnect attempts to the Qpid
|
||||
broker if the ``qpid`` notification strategy is being used. Normally the
|
||||
Qpid client will continue attempting to reconnect until successful.
|
||||
|
||||
* ``qpid_reconnect_interval_min``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This option specifies the minimum number of seconds between reconnection
|
||||
attempts if the ``qpid`` notification strategy is being used.
|
||||
|
||||
* ``qpid_reconnect_interval_max``
|
||||
|
||||
Optional. Default: None
|
||||
|
||||
This option specifies the maximum number of seconds between reconnection
|
||||
attempts if the ``qpid`` notification strategy is being used.
|
||||
|
||||
* ``qpid_reconnect_interval``
|
||||
|
||||
This option specifies the exact number of seconds between reconnection
|
||||
attempts if the ``qpid`` notification strategy is being used. Setting
|
||||
this option is equivalent to setting ``qpid_reconnect_interval_max`` and
|
||||
``qpid_reconnect_interval_min`` to the same value.
|
||||
|
||||
* ``qpid_heartbeat``
|
||||
|
||||
Optional. Default: ``5``
|
||||
|
||||
This option is used to specify the number of seconds between heartbeat messages
|
||||
exchanged between the Qpid client and Qpid broker if the ``qpid`` notification
|
||||
strategy is being used. Heartbeats are used to more quickly detect that a
|
||||
connection has been lost.
|
||||
|
||||
* ``qpid_protocol``
|
||||
|
||||
Optional. Default: ``tcp``
|
||||
|
||||
This option is used to specify the transport protocol to use if using the
|
||||
``qpid`` notification strategy. To enable SSL, set this option to ``ssl``.
|
||||
|
||||
* ``qpid_tcp_nodelay``
|
||||
|
||||
Optional. Default: ``True``
|
||||
|
||||
This option can be used to disable the TCP NODELAY option. It effectively
|
||||
disables the Nagle algorithm for the connection to the Qpid broker. This
|
||||
option only applies if the ``qpid`` notification strategy is used.
|
||||
|
||||
Configuring Access Policies
|
||||
---------------------------
|
||||
|
||||
Access rules may be configured using a
|
||||
:doc:`Policy Configuration file <policies>`. Two configuration options tell
|
||||
the Glance API server about the policies to use.
|
||||
|
||||
* ``policy_file=PATH``
|
||||
|
||||
Optional. Default: Looks for a file called ``policy.json`` or
|
||||
``glance.policy.json`` in standard configuration directories.
|
||||
|
||||
Policy file to load when starting the API server
|
||||
|
||||
* ``policy_default_rule=RULE``
|
||||
|
||||
Optional. Default: "default"
|
||||
|
||||
Name of the rule in the policy configuration file to use as the default rule
|
||||
For more information see :doc:`Glance notifications <notifications>` and
|
||||
`oslo.messaging <http://docs.openstack.org/developer/oslo.messaging/>`_.
|
||||
|
||||
Configuring Glance Property Protections
|
||||
---------------------------------------
|
||||
|
@ -20,24 +20,19 @@ Notifications
|
||||
Notifications can be generated for several events in the image lifecycle.
|
||||
These can be used for auditing, troubleshooting, etc.
|
||||
|
||||
Strategies
|
||||
----------
|
||||
Notification Drivers
|
||||
--------------------
|
||||
|
||||
* logging
|
||||
* log
|
||||
|
||||
This strategy uses the standard Python logging infrastructure with
|
||||
This driver uses the standard Python logging infrastructure with
|
||||
the notifications ending up in file specificed by the log_file
|
||||
configuration directive.
|
||||
|
||||
* rabbit
|
||||
* messaging
|
||||
|
||||
This strategy sends notifications to a rabbitmq queue. This can then
|
||||
be processed by other services or applications.
|
||||
|
||||
* qpid
|
||||
|
||||
This strategy is similar to rabbit. It sends notifications to an AMQP
|
||||
message queue via Qpid.
|
||||
This strategy sends notifications to a message queue configured
|
||||
using oslo.messaging configuration options.
|
||||
|
||||
* noop
|
||||
|
||||
|
@ -226,19 +226,16 @@ registry_client_protocol = http
|
||||
|
||||
# ============ Notification System Options =====================
|
||||
|
||||
# Notifications can be sent when images are create, updated or deleted.
|
||||
# There are three methods of sending notifications, logging (via the
|
||||
# log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid
|
||||
# message queue), or noop (no notifications sent, the default)
|
||||
# NOTE: THIS CONFIGURATION OPTION HAS BEEN DEPRECATED IN FAVOR OF `notification_driver`
|
||||
# notifier_strategy = default
|
||||
|
||||
# Driver or drivers to handle sending notifications
|
||||
# Driver or drivers to handle sending notifications. Set to
|
||||
# 'messaging' to send notifications to a message queue.
|
||||
# notification_driver = noop
|
||||
|
||||
# Default publisher_id for outgoing notifications.
|
||||
# default_publisher_id = image.localhost
|
||||
|
||||
# Messaging driver used for 'messaging' notifications driver
|
||||
# rpc_backend = 'rabbit'
|
||||
|
||||
# Configuration options if sending notifications via rabbitmq (these are
|
||||
# the defaults)
|
||||
rabbit_host = localhost
|
||||
|
@ -26,14 +26,6 @@ import glance.openstack.common.log as logging
|
||||
from glance.openstack.common import timeutils
|
||||
|
||||
notifier_opts = [
|
||||
cfg.StrOpt('notifier_strategy',
|
||||
help=_('Notifications can be sent when images are create, '
|
||||
'updated or deleted. There are three methods of sending '
|
||||
'notifications, logging (via the log_file directive), '
|
||||
'rabbit (via a rabbitmq queue), qpid (via a Qpid '
|
||||
'message queue), or noop (no notifications sent, the '
|
||||
'default). (DEPRECATED)')),
|
||||
|
||||
cfg.StrOpt('default_publisher_id', default="image.localhost",
|
||||
help='Default publisher_id for outgoing notifications.'),
|
||||
]
|
||||
@ -43,14 +35,6 @@ CONF.register_opts(notifier_opts)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
_STRATEGY_ALIASES = {
|
||||
"logging": "log",
|
||||
"rabbit": "messaging",
|
||||
"qpid": "messaging",
|
||||
"noop": "noop",
|
||||
"default": "noop",
|
||||
}
|
||||
|
||||
_ALIASES = {
|
||||
'glance.openstack.common.rpc.impl_kombu': 'rabbit',
|
||||
'glance.openstack.common.rpc.impl_qpid': 'qpid',
|
||||
@ -62,31 +46,9 @@ class Notifier(object):
|
||||
"""Uses a notification strategy to send out messages about events."""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
driver = None
|
||||
transport_url = None
|
||||
publisher_id = CONF.default_publisher_id
|
||||
|
||||
if CONF.notifier_strategy:
|
||||
msg = _("notifier_strategy was deprecated in "
|
||||
"favor of `notification_driver`")
|
||||
LOG.warn(msg)
|
||||
|
||||
strategy = CONF.notifier_strategy
|
||||
|
||||
# NOTE(flaper87): Use this to keep backwards
|
||||
# compatibility. We'll try to get an oslo.messaging
|
||||
# driver from the specified strategy.
|
||||
driver = _STRATEGY_ALIASES.get(strategy)
|
||||
if driver == 'messaging':
|
||||
transport_url = strategy + ':///'
|
||||
|
||||
self._transport = messaging.get_transport(CONF,
|
||||
url=transport_url,
|
||||
aliases=_ALIASES)
|
||||
|
||||
self._transport = messaging.get_transport(CONF, aliases=_ALIASES)
|
||||
self._notifier = messaging.Notifier(self._transport,
|
||||
driver=driver,
|
||||
publisher_id=publisher_id)
|
||||
|
||||
def warn(self, event_type, payload):
|
||||
|
@ -100,46 +100,17 @@ class TestNotifier(utils.BaseTestCase):
|
||||
@mock.patch.object(messaging, 'get_transport')
|
||||
def _test_load_strategy(self,
|
||||
mock_get_transport, mock_notifier,
|
||||
strategy, url, driver):
|
||||
if strategy is not None:
|
||||
self.config(notifier_strategy=strategy)
|
||||
url, driver):
|
||||
nfier = notifier.Notifier()
|
||||
mock_get_transport.assert_called_with(cfg.CONF, url=url,
|
||||
mock_get_transport.assert_called_with(cfg.CONF,
|
||||
aliases=notifier._ALIASES)
|
||||
self.assertIsNotNone(nfier._transport)
|
||||
mock_notifier.assert_called_with(nfier._transport, driver=driver,
|
||||
mock_notifier.assert_called_with(nfier._transport,
|
||||
publisher_id='image.localhost')
|
||||
self.assertIsNotNone(nfier._notifier)
|
||||
|
||||
def test_notifier_strategy_default(self):
|
||||
self._test_load_strategy(strategy='default',
|
||||
url=None,
|
||||
driver='noop')
|
||||
|
||||
def test_notifier_strategy_noop(self):
|
||||
self._test_load_strategy(strategy='noop',
|
||||
url=None,
|
||||
driver='noop')
|
||||
|
||||
def test_notifier_strategy_rabbit(self):
|
||||
self._test_load_strategy(strategy='rabbit',
|
||||
url='rabbit:///',
|
||||
driver='messaging')
|
||||
|
||||
def test_notifier_strategy_qpid(self):
|
||||
self._test_load_strategy(strategy='qpid',
|
||||
url='qpid:///',
|
||||
driver='messaging')
|
||||
|
||||
def test_notifier_strategy_logging(self):
|
||||
self._test_load_strategy(strategy='logging',
|
||||
url=None,
|
||||
driver='log')
|
||||
|
||||
def test_notifier_strategy_none(self):
|
||||
self._test_load_strategy(strategy=None,
|
||||
url=None,
|
||||
driver=None)
|
||||
def test_notifier_load(self):
|
||||
self._test_load_strategy(url=None, driver=None)
|
||||
|
||||
|
||||
class TestImageNotifications(utils.BaseTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user