summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc/amqp.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Remove the amqp_rpc_single_reply_queue option from Havana"Jenkins2013-06-111-91/+9
|\
| * Remove the amqp_rpc_single_reply_queue option from HavanaRaymond Pekowski2013-06-051-91/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | blueprint amqp-rpc-fast-reply-queue As part of the Grizzly code review for the above blueprint (Idb09a714), the Grizzly code base is "aware" of this feature in terms of receiving RPCs and provided with an option for enabling it on the RPC send side. It was decided that in Havana the option would be removed, RPCs would only be sent using the new functionality yet awareness of prior functionality be retained for the receiving of RPCs. This code change implements the Havana piece. Change-Id: I5f2a8e432cf84a637c1aa813656c1cbc8db6e7eb
* | Enable hacking H404 test.Dina Belova2013-06-111-14/+17
|/ | | | | | H404 - multi line docstring should start with a summary. Change-Id: I2099e1ee81ff9657f7a07401b8e8f3327d03bdbd
* Enable hacking H402 testSergey Lukjanov2013-06-031-6/+6
| | | | | | H402 one line docstring needs punctuation Change-Id: Ie848453cace318d8310cdf0234c512f4c1121119
* Enable hacking H401 testSergey Lukjanov2013-05-301-1/+1
| | | | | | H401 docstring should not start with a space Change-Id: I761665ea9aff1f55de9f629ff8d108ba141eaf79
* Enable hacking H703: Multiple positional placeholdersJoe Gordon2013-05-201-2/+3
| | | | | | | Fix and enable test for multiple positional placeholders in localizations Change-Id: Ie3b5e3113cd0f3340b7b0f5774001893b1e6857c
* Add rpc method namespace support.Russell Bryant2013-04-121-4/+7
| | | | | | | | | | | | | | | | | | | | | | RPC endpoints already had the ability to expose multiple APIs ... sort of. You could pass multiple callback objects to the dispatcher and it would check all of them for a method call. This patch adds the ability to set a namespace on a callback object. This makes exposing multiple APIs a bit more like you would expect it to work. You can invoke a method on a specific callback object, as opposed to having it check all of them for the method. This will allow you to create, manage, and version APIs without any potential conflicts with other APIs being exposed by the same endpoint. An example of where I would like to use this is in Nova, where we have some methods that we would like to expose on *all* rpc endpoints. This includes no public API changes and is fully backwards compatible. Implement blueprint rpc-multi-api. Change-Id: Ief4433e2e1c32cfb05b4cd27b87fe32b40f4341d
* Merge "Improves Logging for for rpc method timeouts"Jenkins2013-03-221-1/+0
|\
| * Improves Logging for for rpc method timeoutsMatthew Sherborne2013-03-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the traceback for an rpc timeout from inside an iterator, which gave a useless traceback, into the main flow of the program. It also adds the rpc method being called and the topic used to the exception's message. When the caller logs the message higher up the stack, the log information and traceback will be more useful. Finally it removes the timeout logging in the amqp.py module, in the spirit of bug #1137994 and https://review.openstack.org/#/c/23295/ Works towards: bug #1148516 Change-Id: I29a3b1b97c6114c4479e2b71c1257c4d72131535
* | Enable message envelope.Russell Bryant2013-03-211-1/+1
|/ | | | | | | Grizzly had the ability to receive messages with an envelope, but did not send them. Now update the code to send them. Change-Id: I73aad7697cf83ad4aabb3c2058b7cc4f53f783c2
* Keep exc_info() to prevent an internal errorHaiwei Xu2013-03-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1135539 When SysLogHandler is configured in UDP socket mode, the user who doesn't have the admin privilege got the unexpecting internal server error(HTTP 500) in "nova dns-create-private-domain" command. This bug occurs as the call graph drew below: |--ProxyCallback._process_data():amqp.py |--LOG.exception() | : | |--BaseHub.switch():hub.py | |-- clear_sys_exc_info() | |--ctxt.reply(None, sys.exc_info(),..) | : | |--serialize_remote_exception():common.py |--failure_info#(None,None,None) The sys.exc_info() is cleared by the clear_sys_exc_info(), but it is called again by the ctxt.reply(). This patch prevents the internal error and returns the details of the forbidden error(HTTP 403) which is expected. Change-Id: I549b4b2365c53c401edc80bbe30bcde249d27b85
* Fixes import order nitsZhongyue Luo2013-02-261-2/+3
| | | | Change-Id: I6085bb4a0b990985c8f7a013c89b7d5acafdf312
* AMQP: skip duplicate messagesKei Masumoto2013-02-221-0/+46
| | | | | | | | | | | | | | | | | | | | When using rabbit's mirrored queues or qpid's replicated queues, there are conditions under which you can receive the same message twice. One such condition is where a message has been sent to a consumer but before an ack is received by a consumer, the master fails over to a slave and the slave resends the message. Note that the consumer may have sent the ack, but it was lost as the master went down. Dispatching the same message twice is obviously something we want to avoid. In order to do so, we add a unique_id to each message sent and have consumers maintain a fixed length queue of recently seen unique message IDs. Before dispatching any received message, the queue is checked and the message is skipped if it is a duplicate. Fixes bugs 1107064. Change-Id: I5bfacadbdf7de8b34d6370b9aa869c271957692d
* blueprint amqp-rpc-fast-reply-queueRaymond Pekowski2013-02-181-9/+158
| | | | | | | | | | | For AMQP based RPC, specifically RabbitMQ and Qpid, this change replaces the dynamically created RPC call reply queue with a single queue that is created on the first RPC call and used on all subsequent calls. It provides backward compatibility on the callee side by recognizing downlevel callers and on the caller side by adding a config option to revert to the old dynamically created queue based upon the msg_id. Change-Id: Idb09a71472866bd3950f58d4f7f45a3181eb40fc
* Add join_consumer_pool() to RPC connectionsDoug Hellmann2013-02-131-8/+49
| | | | | | | | | | | | | | | blueprint move-listener-framework-oslo bug 1047015 bug 1111632 Ceilometer and Quantum use private methods of the RPC connection object to configure themselves to listen to a queue shared among a group of workers. This change adds a public method to the RPC connection to support this use case, without resorting to using private API calls. Change-Id: I3a89f1dfdcf8accca70cf305f7a31315bea093d8 Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
* Add TTL to AMQP messagesBrent Eagles2013-01-281-1/+1
| | | | | | | | | | This patch sets a TTL derived from the timeout parameter used when invoking the RPC. Needed for: * Bug 1053614 Change-Id: Idaf9a2a972feac3f95f170c52632033b027b4414
* Merge "Fix debug message in multicall of rpc.amqp"Jenkins2013-01-061-1/+1
|\
| * Fix debug message in multicall of rpc.amqpHengqing Hu2012-12-271-1/+1
| | | | | | | | Change-Id: Ib5ed65df937e9fe4e36cdf7d0ce92b627f22dbd3
* | Merge "Optionally add message envelope to notifications."Jenkins2013-01-061-5/+3
|\ \
| * | Optionally add message envelope to notifications.Russell Bryant2013-01-031-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When message envelopes were added for rpc messages, notifications were explicitly left out. This was due to the fact that notifications are consumed outside of OpenStack. However, notification consumers will likely want to eventually start taking advantage of some of the features that the envelope is a prerequisite for, such as message signing. This patch adds a new notification driver that produces message based notifications including the message envelope. Related to blueprint version-rpc-messages. Change-Id: Iaa8b437e6b4f64053f4b02bf486516f60bb020e9
* | | Merge "Ensure proxy callback threads exit during tests"Jenkins2013-01-051-0/+4
|\ \ \ | |/ / |/| |
| * | Ensure proxy callback threads exit during testsMark McLoughlin2013-01-031-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the consumer side, each message is consumed in a separate thread but we currently have no way of waiting for all these threads to complete. In BaseRpcTestCase.test_call_timeout(), we complete the thread while there is still a message handler running on the other side. This can mean the consumer attempting to send its reply while other tests are running, which clearly is a bad thing. Make the connection close() and reset() methods in the kombu and qpid drivers wait on proxy object threads before returning to avoid this situation. Change-Id: I8fb84b1dc7f31196ef27a5d1f8c4a3346b03e0ae
* / Add a rpc envelope format version number.Russell Bryant2013-01-021-6/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a message envelope that includes a envelope format version number. This message envelope will allow us to embed additional metadata later on, such as a signature for the message payload. Up to this point, we've deferred message serialization as a responsibility of the messaging library we're using by passing it a message as Python types and letting it deal with how to pass it over a network. This patch adds json serialization in the rpc layer of the application message payload before passing the message down into the messaging library. There are some benefits to be gained by doing a pass at serialization ourselves. As an example, we occasionally hit serialization bugs that only affect some messaging drivers. The kombu driver has always had a nice advantage. It uses anyjson internally for serializing messages, which we hook into using our jsonutils module. When there is a problem serializing, we automatically use to_primitive() to fix it. This patch allows all drivers to take advantage of this automatic message fix-up. This also creates a convenient common hook point for messages coming in and out of the system, regardless of the driver in use. While this changes the base format of the messages sent between nodes, it has been done in a backwards compatible manner. The new message format will not be used by default. The idea is that all nodes will be upgraded to a version that is capable of receiving the new format (Grizzly) before switching it on. We will turn it on post-Grizzly. Implement blueprint version-rpc-messages. Change-Id: Ib6b2d11ca42abaa64c40986d72233e7048e504a0
* Register the control_exchange RPC optionMark McLoughlin2012-12-111-5/+1
| | | | | | | | | | | Fixes bug #1031725 Have the control_exchange option be registered by Oslo, but allow projects to override the default of 'openstack' by doing e.g.: rpc.set_defaults(control_exchange='nova') Change-Id: Ic6e534d9a70a1cfc94207b78caa57e897cf78f63
* Allow exceptions to pass over RPC silentlyDan Smith2012-12-061-4/+11
| | | | | | | | | | | | | | | When one service performs an operation on behalf of another, the act of passing back an exception (even a known one) causes a lot of scary log messages about the (presumed to be) error case. This patch adds a client_exceptions decorator common/rpc/common.py, which allows RPC services to declare the list of expected exceptions for each method. If such an exception is raised during the RPC dispatch, it is wrapped in a ClientException so that the RPC layer can gracefully pass it back without overly-verbose logging. This will allow us to fix nova bug 1084707 Change-Id: I4e7b19dc730342091fd70a717065741d56da4555
* Provide i18n to those messages without _()Davanum Srinivas2012-11-281-2/+2
| | | | | | | | | | | | | | | | | bug 1081498 There are a few log messages without _(), but a lot messages with _(). Wrap these log messages with _() in order to make the code consistent. fix missing imports for _ Pass the log message and interpolation argument(s) to the logger separately remove extra parens rework the patch against latest trunk Change-Id: Ib0a7b0f9c57aadfbc2cfc477c6123b885c9c6060
* Make project pyflakes clean.Monty Taylor2012-11-281-3/+4
| | | | | | | | | | | | | Added both a tox test-env for pyflakes and fixed the current pyflakes errors. This did actually fix a couple of bugs. The CI team has started using pyflakes on its projects and also has started using oslo for things, so ignoring pyflakes warnings on the oslo code was starting to get old. However, additionally, pyflakes is pretty solid, so we should maybe consider gating on it across the board. (% locals() is the biggest thing that we do that it doesn't like) Change-Id: Iac1ca62db301892b7863711162fcbc74807eb24f
* Fix common rpc to use common logging instead of python loggingDavanum Srinivas2012-11-241-1/+1
| | | | | | | | Looks like we just need to fix imports Fixes Bug #1072633 Change-Id: Iac84ae3aadbe440f9b19e184f080320e4c6cca5f
* Make projects define 'control_exchange'.Russell Bryant2012-09-111-0/+8
| | | | | | | | | | | | | | | The 'control_exchange' option needs to have a project-specific default value. Just don't register this option and expect it to be registered by the project using this code, at least for now. ****** IMPORTANT NOTE WHEN IMPORTING THIS CHANGE ****** If you are importing this change into a project that uses rpc, you must add the control_exchange option in your code! ******************************************************* Change-Id: Ida5a8637c419e709bbf22fcad57b0f11c31bb959
* Fix import order of gettextutils in amqp.pyEric Windisch2012-07-131-1/+1
| | | | Change-Id: I53ca8308fb61c53274ca1e3d801f22c9b65d41aa
* Fix missing gettextutils in several modules.Eric Windisch2012-07-121-0/+1
| | | | | | Fixes bug 1021453. Change-Id: I05771a588746a0e43fec0078c5c7152dd9d33b9f
* Fix import usage in AMQP for rpc.commonJulien Danjou2012-06-201-1/+1
| | | | | | | | | | | The existing line is technically OK, but it's not replaced by update.py on file copy, therefore the import of common.rpc.amqp fails. This fixes this problem by using a different syntax, the one that update.py understand. Change-Id: Id30f581477ab09c2b66fc0d65f1029554b311549 Signed-off-by: Julien Danjou <julien@danjou.info>
* Merge "Fix nova.rpc references in comments."Jenkins2012-06-191-1/+1
|\
| * Fix nova.rpc references in comments.Russell Bryant2012-06-131-1/+1
| | | | | | | | | | | | | | | | Part of blueprint common-rpc. Strip remaining references to 'nova.rpc' that existed in comments. Change-Id: I27885918a5e38eb730504c9e88bdda2b72b23257
* | Update common code to support pep 1.3.Gary Kotton2012-06-181-10/+11
|/ | | | | | bug 1014216 Change-Id: I3f8fa2e11c9d3f3d34fb20f65ce886bb9c94463d
* Add rpc to openstack-common.Russell Bryant2012-06-061-0/+416
Implements blueprint common-rpc. This patch imports nova.rpc to openstack-common. All of the necessary changes to the core code to make it compatible with openstack-common have been done in nova, so the only changes made here are to imports. There are more changes made to the tests, but nothing that changes the core functionality of the tests. Change-Id: I17330aa4adfd0f22c449a2376833c7fe9dfd0cf1