Commit Graph

26 Commits

Author SHA1 Message Date
Balazs Gibizer 7b3968d9b0 [rabbit] use retry parameters during notification sending
The rabbit backend now applies the [oslo_messaging_notifications]retry,
[oslo_messaging_rabbit]rabbit_retry_interval, rabbit_retry_backoff and
rabbit_interval_max configuration parameters when tries to establish the
connection to the message bus during notification sending.

This patch also clarifies the differences between the behavior
of the kafka and the rabbit drivers in this regard.

Closes-Bug: #1917645
Change-Id: Id4ccafc95314c86ae918336e42cca64a6acd4d94
2022-01-12 12:22:55 +01:00
Andreas Jaeger e44c988306 Remove six usage
Remove six, the python 2/3 compatibility library. It's not needed
anymore since the repo is python3 only.

Remove a now unneeded hacking test.

Change-Id: I40522c4accb4aaf8115d11fee8b081e2d991cb4d
2020-05-11 10:21:58 +02:00
Hervé Beraud 54356899da fix typos
Change-Id: Id11db4113c9b1c3add602192c1e915218704ef27
2019-06-18 14:00:14 +02:00
Hervé Beraud 4f385720d7 Remove log translation and i18n
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

Change-Id: I9ddb6595fc52e46ed8844e39d2fa71029c90b65c
Closes-Bug: #1674567
2019-04-24 11:55:38 +02:00
Sean McGinnis 4d48b33a41 Handle collections.abc deprecations
The use of ABC classes directly from collections has been deprecated in
3.x versions of Python. The direction is to use the classes defined in
collections.abc. Python 2.7 does not have this, but Python 3.8 will be
dropping the backwards compatibility to use the old location.

Six also does not have support for this yet, so in the mean time to make
sure we don't run into issues as folks try to move to 3.8, and to get
rid of deprecation warnings in logs, this handles importing from the
preferred location and falls back if it not available.

Change-Id: If67133813634f41d89ccdf0f6d6d5ffa66c97dd8
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-04-09 16:43:45 -05:00
Kenneth Giusti 83a84d3f98 Explain why Listener connections cannot be pooled
Restoring an old comment to the code that explains why the RabbitMQ
driver provides a dedicated connection for each listener.

Change-Id: If833d41d78444cc26535cb165ea821dce21b768b
2019-03-18 12:26:47 -04:00
Kenneth Giusti 679572272e Fix debug log message - missing argument
Change-Id: I811c6051808a34fa5235b47e56ee3b41cb35adad
2018-07-06 11:41:07 -04:00
Kenneth Giusti ae9e673887 Fix the bandit security linter test
Add the bandit security linter test to the pep8 target

Change-Id: I9324b9d9df77fd05c2e10bb48d7ccf8b4c634525
2018-07-02 13:16:11 -04:00
TommyLike 7188835890 Add warning output if failed to rebuild exception when deserialize
In some specific cases, the middleware would fail to rebuild
the original exception, see bug [1] below. Adding this output
may help locate the root cause quickly.

[1]: https://bugs.launchpad.net/cinder/+bug/1728826

Change-Id: Ia9304bda4e515812b146885f830e70f28a285f2d
2018-06-06 14:04:40 +08:00
Dan Smith 68c48ad0bb Add restart() method to DecayingTimer
This merely provides a restart() method that passes through to the existing
restart() method on the StopWatch used as the internal for DecayingTimer so
that we can reset it.

Change-Id: Ie6b607ec588db94e2c768bd22ae736a05ab484c1
2018-03-07 10:24:52 -08:00
Mehdi Abaakouk 037dee19ed Validate the transport url query string
When driver load we allow to override option unrelated to the driver and
to set option useless for the driver.

This change validates the query string when the driver load to report as
soon as possible invalid options. And allow to override only option
of the driver option group (ie: [oslo_messaging_<driver_name>].

Related-bug: #1666903

Change-Id: Iaf23f773279c10bf37d545883ada7c2f6a9ffbbf
2017-02-27 13:10:31 +01:00
Li-zhigang ea8fad47a5 Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve iterators.
We can use dict.items instead, as it will return iterators in PY3 as well.
And dict.items/keys will more readable. 2.In py2, the performance about
list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ia235afc3532f62f265f91ca46d2306c72fc2a2a2
2016-11-23 09:02:14 +00:00
Claudiu Belu da830016d5 Properly deserializes built-in exceptions
If the remote target and the caller have different python
versions, then built-in exceptions raised by the remote target
will not be properly deserialized on the caller. Because of this,
oslo.messaging will simply raise a RemoteError, instead of any
expected exceptions the caller might expect.

This patch addresses this issue.

Closes-Bug: #1630795

Change-Id: I6d9eaf5497e746be9766731172406ec624ef9ba7
2016-10-05 16:57:55 -07:00
Gevorg Davoian 282cbc222e Add query paramereters to TransportURL
This patch proposes to allow TransportURLs to have query parameters
with driver-specific options which may override corresponding
values from a static configuration. As an example, the patch
implements this possibility in the pika driver. If the idea is
approved, it will be possible to also implement it in the other
drivers.

Change-Id: Ibb7e13b4509fde035a3c334cde9bc4c498f92140
2016-06-09 16:05:36 +03:00
Gevorg Davoian 39749c77a8 Remove logging from serialize_remote_exception
This patch removes log_failure argument from the function
serialize_remote_exception and from driver implementations
using it (because it is never used and always defaults to True)
and prevents error logging in this function (because these errors
are already logged by servers while processing incoming messages).

Change-Id: Ic01bb11d6c4f018a17f3219cdbd07ef4d30fa434
Closes-Bug: 1580352
2016-05-19 15:18:28 +03:00
Victor Stinner bb4121a465 Revert "Ensure the json result type is bytes on Python 3"
This reverts commit bd81d09c02.

I understand that the change was supposed to fix something, but instead it broke all tests on Python 3!?

It's wrong to replace blindly json.dumps() with jsonutils.dump_as_bytes(). In oslo messaging, the result is usually used as a value in a dictionary, and then the whole dictionary is passed to a second serializer which also serialize to JSON.

Sorry, I don't understand everything, but at least I see that tests passed on py3 before the change, and started to fail with the change.

Maybe json(utils).dumps() is misused in some places, but in this case, you should write a change which only fix these specific places, not replace all calls to dumps().

Change-Id: Icd54ee8e3f5c976dfd50b4b62c7f51288649e112
2016-03-11 09:00:08 +00:00
Javeme bd81d09c02 Ensure the json result type is bytes on Python 3
Since the json.dumps() returns Unicode string On Python 3, to
ensure that the result type is bytes on Python 2 and Python 3
that if the result is used for the message body, let's replace
    json.dumps() /  oslo_serialization.jsonutils.dumps()
with
    oslo_serialization.jsoutils.dump_as_bytes()

Change-Id: I0e0f6b715ffc4a9ad82be52e55696d032b6d0976
2016-02-24 15:20:08 +08:00
ChangBo Guo(gcb) 6b20fa8597 Improvement of logging acorrding to oslo.i18n guideline
1. Use translation marker functions, their argument must just be a string
2. Any message with more than one variable should use named
   interpolation instead of positional to allow translators
   to move the variables around in the string to account for
   differences in grammar and writing direction.
3. String interpolation should be delayed to be handled by the logging
   code, rather than being done at the point of the logging call.
For more details, please refert to oslo.i18n guideline [1]

Note: this commit doesn't touch test code.

[1] http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: I5f013d65b20396bbe0e5a2cceaed2a33fad1af23
2016-01-07 13:26:55 +08:00
Davanum Srinivas 46daf85814 Cleanup parameter docstrings
Change-Id: I301fdd51446bf0c0a6dd0d05b26da0556db8367d
2015-12-11 11:04:13 +03:00
Davanum Srinivas 357dcb75ab Move ConnectionPool and ConnectionContext outside amqp.py
ConnectionPool and ConnectionContext can be used by other
drivers (like Kafka) and hence should be outside of amqp.py.
* Moving ConnectionPool to pool.py
* Moving ConnectionContext to common.py
* Moving a couple of global variables to common.py

No other logic changes, just refactoring

Change-Id: I85154509a361690426772ef116590d38a965ca8d
2015-11-30 11:53:48 +00:00
Davanum Srinivas 588d795b3c Use proper translating helper for logging
Add hacking rule borrowed from keystone to make sure
we don't regress and fix all the issues found by the
hacking check.

Change-Id: I41635fdd83c3e04d04f9849a72c49ccb5ac42875
2015-08-20 21:01:59 -04:00
Joshua Harlow 8da14f68d3 Use the oslo_utils stop watch in decaying timer
The decaying timer can now just use the functionality
of the oslo_utils stop watch to avoid having to maintain
similar information itself; now it just becomes a thin
layer ontop of that object that provides its functionality.

Change-Id: I1b014b821a6b980590ca5b4d850a515d55c42208
2015-03-23 20:06:22 -07:00
Fei Long Wang cf365fe40d Minor improvement
Return the variable instead of doing useless check

Change-Id: I4c5893157f396c3f4bf6ef9d18ff1692af2c5b33
2015-03-18 16:04:24 +13:00
Mehdi Abaakouk 434b5c8781 Declare DirectPublisher exchanges with passive=True
If rabbit dies, the consumer can be disconnected before the publisher
sends, and if the consumer hasn't declared the queue, the publisher's
will send a message to an exchange that's not bound to a queue, and
the message wll be lost.  Setting passive=True will cause the
publisher to fail and retry if the consumer hasn't declared the
receiving queue yet.

Co-Authored-By: Noel Burton-Krahn <noel@burton-krahn.com>
Closes-Bug: #1338732
Change-Id: I5ba4d311b97236d3a85a9f5badff61f12b08c12d
2015-01-27 11:07:51 +01:00
Doug Hellmann ee31a84719 Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages
2015-01-21 21:09:33 -05:00
Doug Hellmann e55a83e832 Move files out of the namespace package
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
2015-01-12 12:50:41 -05:00