Blueprint remove-namespace-packages
Depends-on: I2eeef93ee2e61a721c69f62add819f93f62f077d
for openstack/ceilometer
Depends-on: I26390dd908769be5f1a5b70be22d3b98e3a45563
for openstack/ceilometermiddleware
Depends-on: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
for openstack/glance
Depends-on: I029c3260051aa48cfaae428c096c1ac7b43b2bd2
for openstack/ceilometermiddleware
Change-Id: I8c5595bbafa82db33f62fa47d214f5cb756a2639
Move the public API out of oslo.messaging to oslo_messaging. Retain
the ability to import from the old namespace package for backwards
compatibility for this release cycle.
bp/drop-namespace-packages
Co-authored-by: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
Change-Id: Ia562010c152a214f1c0fed767c82022c7c2c52e7
This change warns the user that it does have monkeypatched the
oslo.messaging library correclty.
Change-Id: Ice80ffc6cbc39919eac4bc0809992daea51b5922
Closes-bug: #1288878
It is confusing to report that the version cap is too low, rather we
should report that the message version is too high.
Change-Id: Ic37eabb6f211fb68ca567ed4c400a1314e25cc68
The callback will be used in the new aiogreen executor to support
trollius coroutines.
The change includes an unit test.
Change-Id: I556b112371bec2ec29cea4dc254bb3f9c6d2c07a
This helps in circumstances where the only stacktrace visible
is on the target side (e.g. due to cast or fanout operations)
and without the method information is difficult to root cause
what is going on.
Change-Id: I070ecda4d56186fcda8e8bfc49bf723928998393
Closes-bug: #1340277
Sample code in the documentation for rpc.server has an error which
prevents the code from being run. Replacing the `self` with `None`
results in code that runs. Whether it does anything useful is
an open question.
Change-Id: I81391fa3efdc65d54ca3aa155d63584f2b6f98c2
According to the IBM Style Guide the Latin abbreviation 'e.g.'
should be replace by 'for example'.
Change-Id: I694df5ed62213e29bdf35f781fd6f310b7df77a6
The eventlet executor need additional code to make the RPC server sample
work. Using the blocking executor makes things easier to setup for a
newcomer.
Change-Id: I56dfa54a178962d4ced34e2f15eaf9312b7087cc
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.
Change-Id: I4a7ce6916aefb2f2d445f0ebd977c824b1c51e24
Partial-Bug: #1321274
When a rpc client try to make a RPC call and the server is unreachable
The rpc call hang until the server come back.
In most case this is the desired behavior.
But sometimes, we can prefer that the library raise an exception after a
certain number of retries.
For example in ceilometer, when publishing a
storage.objects.incoming.bytes sample from the Swift middleware to an
AMQP topic, you might not want to block the Swift client if the AMQP broker
is unavailable - instead, you might have a queueing policy whereby
if a single reconection attempt fails we queue the sample in memory and
try again when another sample is to be published.
This patch is the oslo.messaging part that allow this.
Closes bug #1282639
Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com>
Change-Id: I32086d0abf141c368343bf225d4b021da496c020
In oslo.messaging design phase, it was planned to introduce executor
specific RPCServer types though they were never implemented. References
to those types sneaked into docstrings from the original design
document. Since we're not going to implement those types now, docstrings
should be updated accordingly.
Change-Id: Ic4017bb8f89d47115bb7dc59483e81d26c76212b
Currently the format string is a normal string, which in
py2x is not unicode. When the unicode exception information is
used to replace the %s, str() is called on it, but because
it is unicode str() fails. Making the format string unicode
fixes this. For the error log this is done by making it
translatable and for the debug message by explicity making
it unicode.
The exception will contain unicode when the exception being
returned by the other project is either translated to a
language using unicode characters or when lazy translation
is enabled and a gettextutils.Message instance is returned.
Change-Id: I1706f5eb9dfbee434f8882b03dad4674d955c370
Closes-Bug: #1310397
This patch make the dispatcher responsible of the message
acknowledgement.
This is the preliminar step to be able to requeue message.
Partial implements blueprint notification-subscriber-server
Change-Id: If74b47d5e23976d407deb27df7395b1982963c75
The notification listener doesn't have anything to send to the notifier
and the notifier doesn't attend to receive something.
So this patch remove the message reply when the listener is a
notification
listener.
Partial implements blueprint notification-subscriber-server
Change-Id: Ic989947ba3b6894cde788422842fca19159ea261
Follow oslo.config style guide for help strings better to create
consistent help strings:
* Capitalize first word of each help string
* Finish help strings with "."
Change-Id: Ia08fa09593661e6e5b834d98bbd92689c2674075
Catch expected exceptions in a way that supports subclasses also being
seen as "expected."
Log a little more detail about unexpected exceptions in the ExecutorBase
so it is easier to add them to the list of expected exceptions.
Change-Id: I1bdd628eba717308f0afe1a889efd8711bad6296
Closes-bug: #1276163
The dispatcher is now responsible to configure and to get the listener from
the transport.
The server just ask to the dispatcher to build and return a configured
listener for a provider transport.
Partial implements blueprint notification-subscriber-server
Change-Id: I4a6d9620b8239f6d377bc5788b8a90a860b2f02c
dict.iteritems() was replaced with dict.items() in Python 3. Use the
six.iteritems() function to get code compatible with Python 2 and Python 3.
Change-Id: I0c8ecc3ae540ffaf4c6b159e09ca16ccf365973d
This removes a few import and global variables that are not used through
the code. That cleans things a little.
Change-Id: I7b30bb11e8ad3c2df01ca2107eff2444feed3fe2
I added check_for_lock because I assumed it was enabled by default and
actively in use by Nova. However, it actually isn't used by Nova yet and
enabling spews a tonne of warnings.
It's a rather clunky API and there's a good chance we can design a
better API for it, so let's leave it out until we're ready to actually
start using it in Nova.
Related-Bug: #1063222
Change-Id: Ib890978398059f360cd0f3352f4755262b8111c6
Oslo's logging code has some useful support for including bits of the
request context in log messages. While this isn't exclusively about the
request context in a dispatching RPC method, it seems useful for
oslo.messaging to support the concept for at least this use case simply
by recording the context in a thread local store before dispatching an
endpoint method and immediately clearing it when the method returns.
Note, we don't need to store weak refs in our store because we will
clear the reference in all cases rather than ever leaving a stale
reference around in the store.
Change-Id: I70ac06ed3a2a891a7a7b388b1823a0f3b08f2dd1
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
If a remote endpoint raises an exception which the client is not allowed
to (or cannot) deserialize, then RPCClient.call() raises a RemoteError
exception instead.
Make this exception type part of the public API.
Change-Id: I70be0ab7d40af3224d93d6bd0522c1a82f6303c3
Review I4e7b19dc730342091fd70a717065741d56da4555 gives a lot of the
background here, but the idea is that some exceptions raised by an RPC
endpoint method do not indicate any sort of failure and should not be
logged by the server as an error.
The classic example of this is conductor's instance_get() method raising
InstanceNotFound. This is perfectly normal and should not be considered
an error.
The new API is a decorator which you can use with RPC endpoints methods
to indicate which exceptions are expected:
@messaging.expected_exceptions(InstanceNotFound)
def instance_get(self, context, instance_id):
...
but we also need to expose the ExpectedException type itself so that
direct "local" users of the endpoint class know what type will be used
to wrap expected exceptions. For example, Nova has an ExceptionHelper
class which unwraps the original exception from an ExpectedException and
re-raises it.
I've changed from client_exceptions() and ClientException to make it
more clear it's intent. I felt that the "client" naming gave the
impression it was intended for use on the client side.
Change-Id: Ieec4600bd6b70cf31ac7925a98a517b84acada4d
Inspired by tulip, have every module define a __all__ list and import *
from the top-level module.
Rename transport.set_defaults() since we don't want this to be a
top-level set_defaults() function as there may be multiple.
Also, rather than configuring flake8 to allow star imports, just exclude
the __init__.py files from flake8 checks.
Add a helper method to the RPCClient class. This is a little nicer to
use for checking to see if a given message is copmatible with the set
version cap.
This can be used in a bunch of different ways:
client = RPCClient(version_cap='1.6', version='1.0')
client.can_send_version()
client.can_send_version(version='1.6')
client = client.prepare(version_cap='1.8', version='1.5')
client.can_send_version()
client.can_send_version(version='1.2')
Co-authored-by: Russell Bryant <rbryant@redhat.com>
Similar to doing listen() on the server side, if the driver throws an
exception when we do a cast() or call() we should translate it into
a transport-agnostic exception.