10 Commits

Author SHA1 Message Date
Doug Hellmann
dd8eb5196f Use stevedore's make_test_instance
Replace the use of TestManager with make_test_instance
to get an instance of the type of manager expected.
The old TestManager class is deprecated

Change-Id: I717c0296bf8ae07b1dad8f0045bfe12c8620ad0a
Partial-bug: #1273455
2014-01-27 19:23:18 -05:00
Sandy Walsh
30c9334306 Routing notifier
Takes a yaml-based config file
(see etc/oslo/routing_notifier.yaml.sample) via
routing_notifier_config option.

Events may be routed by priority or event_type.

Implements: blueprint configurable-notification
Change-Id: I437dfac348f387044e6da3d6a0bbb208323c1741
2014-01-15 04:08:18 +00:00
Zhongyue Luo
d3f3fd7759 Removes use of timeutils.set_time_override
The set_time_override function in timeutils was written as a
helper function to mock utcnow for unittests before 'mock' was
generally used. Now that we have mock and fixture, we no longer
need to use it.

Change-Id: I9a0727edab12ccd5f1e4eb4f5f62d588f5a0faee
Partial-Bug: #1266962
2014-01-13 08:00:36 +08:00
Sandy Walsh
43884bfbb4 Add Sample priority
With the routing notifier we can now issue high-frequency notifications
and not worry about clogging up the queue. The Sample priority will
be used for this situation.

Change-Id: Ia4aa77b7aa4ca9458e97ca3ed81101d92934b691
2013-12-17 15:47:42 +00:00
Julien Danjou
010163d8ee notifier: add audit level
This maps what is provided by the openstack.common.logging module.

Change-Id: Id581c4c748e2763a2c9a3e576e3bd497595adbff
2013-11-29 14:47:03 +01:00
Zhongyue Luo
c59e04fbfa Replace assertEquals with assertEqual
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals.

Change-Id: Iba0ae72e72470cdf5b122defcd68effc5434f948
2013-10-23 16:23:01 +08:00
Mark McLoughlin
361092a488 Add a Notifier.prepare() method
Nova sends notifications with a bunch of different publisher_ids, so we
instantiate quite a lot of Notifier objects. Loading the noification
drivers for each of these is a substantial amount of overhead.

One obvious answer would be to make publisher_id an argument to the
error(), info(), etc. methods, but I think it's nice to encapsulate the
publisher_id in a notifier instance.

Instead, add a prepare() method which mirrors the approach in RPCClient.
You use this method to create a specialized notifier instance with a new
publisher_id.

Change-Id: Ia45fda3164086bb7a9ef6dee0587f726ab8b1a97
2013-08-21 07:30:49 +01:00
Mark McLoughlin
2abb40f9e9 Add a context serialization hook
The client call() and cast() methods take a request context argument
which is expected to be a dictionary. The RPC endpoint methods on the
server are invoked with a dictionary context argument.

However, Nova passes a nova.context.RequestContext on the client side
and the oslo-incubator RPC code deserializes that as a amqp.RpcContext
which looks vaguely compatible with Nova's RequestContext.

Support the serialization and deserialization of RequestContext objects
with an additional (de)serialize_context() hook on our Serializer class.

Note: this is a backwards incompatible API change because Serializer
implementations which do not implement the new abstract methods would
no longer be possible to instantiate. Not a problem with this commit,
but shows the type of compat concerns we'll need to think about once the
API is locked down for good.

Change-Id: I20782bad77fa0b0e396d082df852ca355548f9b7
2013-08-09 08:24:49 +01:00
Mark McLoughlin
206c19e99e Add a driver method specifically for sending notifications
Notifications are an unusual case in that we need users to manually opt
in to new incompatible message formats by editing configuration because
there may be external consumers expecting the old format.

Add a send_notification() method to the driver interface and add a
format version paramater to the method, to make it clear that this
version selection is specifically for notifications.

In the case of the rabbit/qpid drivers, the 2.0 format is where we added
the message envelope.

Change-Id: Ib4925c308b1252503749962aa16f043281f2b429
2013-08-07 06:51:35 +01:00
Mark McLoughlin
7c087f23d2 Unit tests for notifier 2013-06-24 12:52:56 +01:00