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 removes a TODO and also fixes a issue due to the
global state of oslo.config.cfg.CONF.
Closes bug: #1397339
Change-Id: Ib366f35678f899fda93821e6f07897baf8f631b4
We can now set the pool name of a notification listener
to create multiple groups/pools of listeners consuming notifications
and that each group/pool only receives one copy of each notification.
The AMQP implementation of that is to set queue_name with the pool name.
Implements blueprint notification-listener-pools
Closes-bug: #1356226
Change-Id: I8dc0549f5550f684a261c78c58737b798fcdd656
The documentation for the classmethod `parse` states that
The last parsed username and password will be propagated to the rest
of hosts specified::
user:pass@host1:port1,host2:port2
[
{"username": "user", "password": "pass", "host": "host1:port1"},
{"username": "user", "password": "pass", "host": "host2:port2"}
]
However, in practice one needs to specify the usernames and passwords
individually with every host.
DocImpact: Documentation needs to be changed due anomaly in TransportURL
parse classmethod.
Change-Id: I1a9e07e0380a0d6f7d00731df93c9ba01ae20e0e
Closes-Bug: #1355684
According to the IBM Style Guide the Latin abbreviation 'e.g.'
should be replace by 'for example'.
Change-Id: I694df5ed62213e29bdf35f781fd6f310b7df77a6
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this.
Change-Id: I67cc0774a65886ef9fce0b72e52157b622248a85
Closes-Bug: #1327473
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
The amqp connection pool uses the Transport Url as key
to track the connection, but currently a different hash can be
returned for the same url.
This change fixes the hash method of the TransportUrl
Change-Id: Id701d6a80a909d6bd6dabe680c2b8e09dd721ef1
Closes-bug: #1316891
Module py3kcompat was removed from oslo-incubator, we can use
six directly.
Syncing module network_utils:
162e850 Remove import workaround of SplitResult
897aa7c urlsplit issues with IPv6 addresses in python26
35dc1d7 py3kcompat: remove
Change-Id: I71446362209c306c7e8858f4713a59b84fbcc1b2
Closes-Bug: #1280033
In commit d8d2ad9 we added support for notification listener endpoint
methods to return REQUEUE, but if a driver does not support this we
raise NotImplementedError when the application attempts to requeue
a message.
This requeuing behaviour might only be used by an application in
unusual, exceptional circumstances and catch users by surprise.
Instead, let's require the application to assert that it needs this
feature in advance and raise NotImplementError at that point if the
driver doesn't support it.
Change-Id: Id0bb0e57d2dcc1ec7d752e98c9b1e8e48d99f35c
basestring does not exist anymore in Python 3: use six.string_types instead.
In "try: .../except Exception as err: ...", err is a local variable, it does no
more exist after the except block. Copy the exception in a new cls_error
variable to fix Python 3 support.
Extract of Python 3 documentation: "When an exception has been assigned using
as target, it is cleared at the end of the except clause. (...) Exceptions are
cleared because with the traceback attached to them, they form a reference
cycle with the stack frame, keeping all locals in that frame alive until the
next garbage collection occurs."
http://docs.python.org/3.3/reference/compound_stmts.html#try
Change-Id: I2efb14b3838f78d1ed5e09b3ccd4e796a3448aee
Some modules have different names in Python2 and Python3. This patch
make them compatible with Python 3.
* Use six.moves.filter instead of itertools.ifilter() in Python 2.
* Use common.py3kcompat.urlutils instead of urllib and urlparse.
Change-Id: Ia27ebf6057d91d0e129fbe90f995cfdaa89efa8a
We need to support deprecated transport driver configurations like:
rpc_backend = nova.rpc.impl_kombu
i.e. 'nova.rpc.impl_kombu' is a deprecated alias for 'rabbit'.
Initially, we supported this by adding the aliases to each project's
setup.cfg:
oslo.messaging.drivers =
nova.rpc.impl_kombu = oslo.messaging._drivers.impl_rabbit:RabbitDriver
However, this means that code like this:
url = str(TransportURL(conf))
generates a bogus URL string like:
nova.rpc.impl_kombu://...
We need to apply these transport aliases when we load drivers, but also
when we create transport URLs from configuration containing potentially
deprecated aliases.
To enable that, add an aliases parameter to TransportURL(),
TransportURL.parse() and get_transport().
blueprint: transport-aliases
Change-Id: Ifce68ff62746c2a363c719417a2bd0a78ee025dd
Oslo.messaging.Transport is used as an abstraction to redirect function
calls to the configured driver. _send_notification called
self._driver.send instead of self._driver.send_notification
As the test
oslo.messaging.tests.TestTransportMethodArgs.test_send_notification also
assumed that send was the correct method, this should be changed
accordingly
Change-Id: I9406d74f3dc13c44d1aaad5379aafbf1a8580137
'rabbit' is the canonical name for the driver and 'kombu' is just an
alias, so let's set the default to the canonical.
Change-Id: If163ece6793d2a7d6e99d0c8df1745bbcf9a36e6
Handle e.g. foo://u:p@/bar. Right now we get:
IndexError: string index out of range
from:
if hostname[0] == '[':
Change-Id: I0bccebb14ad1d37862955e8988d160240bd1cf6d
Just copies code from Nova's cells code.
See I6b18f7643ab694f5ff34206b80865c40b1ec2680 for where this code was
first introduced.
Change-Id: If9b1503ed47f5910c0ab44edfbe3f42fcce9bf18
Nova's cells/rpc_driver.py has some code which allows user of the REST
API to update elements of a cell's transport URL (say, the host name of
the message broker) stored in the database. To achieve this, it has
a parse_transport_url() method which breaks the URL into its constituent
parts and an unparse_transport_url() which re-forms it again after
updating some of its parts.
This is all fine and, since it's fairly specialized, it wouldn't be a
big deal to leave this code in Nova for now ... except the unparse
method looks at CONF.rpc_backend to know what scheme to use in the
returned URL if now backend was specified.
oslo.messaging registers the rpc_backend option, but the ability to
reference any option registered by the library should not be relied upon
by users of the library. Imagine, for instance, if we renamed the option
in future (with backwards compat for old configurations), then this
would mean API breakage.
So, long story short - an API along these lines makes some sense, but
especially since not having it would mean we'd need to add some way to
query the name of the transport driver.
In this commit, we add a simple new TransportURL class:
>>> url = messaging.TransportURL.parse(cfg.CONF, 'foo:///')
>>> str(url), url
('foo:///', <TransportURL transport='foo'>)
>>> url.hosts.append(messaging.TransportHost(hostname='localhost'))
>>> str(url), url
('foo://localhost/', <TransportURL transport='foo', hosts=[<TransportHost hostname='localhost'>]>)
>>> url.transport = None
>>> str(url), url
('kombu://localhost/', <TransportURL transport='kombu', hosts=[<TransportHost hostname='localhost'>]>)
>>> cfg.CONF.set_override('rpc_backend', 'bar')
>>> str(url), url
('bar://localhost/', <TransportURL transport='bar', hosts=[<TransportHost hostname='localhost'>]>)
The TransportURL.parse() method equates to parse_transport_url() and
TransportURL.__str__() equates to unparse_transport().
The transport drivers are also updated to take a TransportURL as a
required argument, which simplifies the handling of transport URLs in
the drivers.
Change-Id: Ic04173476329858e4a2c2d2707e9d4aeb212d127
My original thinking was that if you're using the exchange name to
separate two instances of the applications (so their queues don't
collide) then the exchange name is pretty key to transport
configuration. In fact, it's really a virtual host that you'd use for
this (at least in the case of rabbit and qpid).
Also, Nova's cells code has already moved ahead with the assumption that
the path specifies a virtual host, so it'd only make sense to deviate
from that if there was a really good reason to.
Change-Id: Ic8b5dc3538b6b17afec524047acc2efa76366377
Currently we have a allowed_rpc_exception_modules configuration variable
which we use to configure a per-project list of modules which we will
allow exceptions to be instantiated from when deserializing remote
errors.
It makes no sense for this to be user configurable, instead the list of
modules should be set when you create a transport.
Closes-Bug: #1031719
Change-Id: Ib40e92cb920996ec5e8f63d6f2cbd88fd01a90f2
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
The target preconditions (e.g. you need at least a topic to send) are
the same for all drivers, so enforce them before we ever call into a
driver.
Change-Id: Ic4e9bd94bd9f060ec0662d2bb778c699903dddc4
Pretty obvious that we need this.
The rabbit/qpid implementations just empty the connection pool, in the
same way their module-level cleanup() methods do now.
Change-Id: I70ba5cab3eb7a30f74cdd6cafe60087769a77b57
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.