Commit Graph

82 Commits (b5c41bba00375d4fb42e740c23b98a5b70af6820)
 

Author SHA1 Message Date
Mark McLoughlin b5c41bba00 Add oslo.messaging project infrastructure 10 years ago
Mark McLoughlin 50f5f3b925 Add some RPC server tests
These actually test the blocking executor and fake driver too.
10 years ago
Mark McLoughlin a32e0b42a5 More gracefully handle "no listeners" in fake driver 10 years ago
Mark McLoughlin badb0fa4e6 Better error handling in server.start()
Transport drivers can raise transport driver specific exceptions
in listen(). Catch such exceptions and wrap them in a ServerListenError
which callers to start() can explicitly handle.
10 years ago
Mark McLoughlin f0f3d4b5f2 Re-work server API to eliminate server subclasses
This is something I think Doug has been trying to tell me to do from the
start :-)

The main idea is to remove all the MessageHandlingServer subclasses and,
instead, if you want a server which is hooked up with the RPC dispatcher
you just use this convenience function:

  server = rpc_server.get_rpc_server(transport, target, endpoints)

This means the dispatcher interface is now part of the public API, but
that should be fine since it's very simple - it's a callable that takes
a request context and message.

However, we also need to be able to construct a MessageHandlingServer
with a specific executor. By having an executor_cls parameter to the
constructor as part of the public API, we'd be exposing the executor
interface which is quite likely to change. Instead - and this seems
obvious in retrospect - just use stevedore to load executors and allow
them to be requested by name:

  server = rpc_server.get_rpc_server(transport, target, endpoints,
                                     executor='eventlet')

This also means we can get rid of openstack.common.messaging.eventlet.
10 years ago
Mark McLoughlin 7a1c2730a0 Add license header to _executors/__init__.py
Bleh.
10 years ago
Mark McLoughlin 7ca7fed9ea Add RPCDispatcher tests 10 years ago
Mark McLoughlin 3e07f5b5bf Check for return value in client serializer test 10 years ago
Mark McLoughlin f8648b36cf Add note about can_send_version() 10 years ago
Mark McLoughlin 8f3ab4fa09 More client unit tests 10 years ago
Mark McLoughlin fbb20dda28 Make RPCClient.check_for_lock a callable
We really don't want to depend on openstack.common.local since it
implies a dependency on eventlet.corolocal.

Instead, make the check_for_lock parameter a callable which is given the
ConfigOpts object and returns a list of held locks. To hook it up to
lockutils, just do:

  client = messaging.RPCClient(transport, target,
                               check_for_lock=lockutils.check_for_lock)

Although you probably want to use lockutils.debug_check_for_lock() which
only does the check if debugging is enabled.
10 years ago
Mark McLoughlin d80b8fe683 Apply version cap check when casting
We were only applying it when calling.
10 years ago
Mark McLoughlin 5972e8c16f Make RPCVersionCapError extend base exception 10 years ago
Mark McLoughlin 08744d849a Remove a bogus param from client.prepare() docs 10 years ago
Mark McLoughlin 0da344d8fc pep8 fixes for serializer code 10 years ago
Mark McLoughlin 2f1ef1ffe3 Simple RPCClient test 10 years ago
Mark McLoughlin 62dcede6b6 Unit tests 10 years ago
Mark McLoughlin 95119398e2 Move some stuff into doc/
This won't end up in the final patch set, just leave here for now. Also
makes nose ignore the test code.
10 years ago
Mark McLoughlin 6929a72987 Implement Target.__eq__()
Needed for unit tests, but probably useful for other cases too.
10 years ago
Mark McLoughlin 79a10f26ee Fix bug in exchange_from_url()
Needs testing obviously :)
10 years ago
Mark McLoughlin a0feafa9a7 pep8 fixes for fake driver 10 years ago
Mark McLoughlin 1e61c02742 Make utils.parse_url() docstring pep8 compliant 10 years ago
Mark McLoughlin 2ba5a6a1be Don't translate exceptions
All our exceptions so far don't seem to be messages we ever
intentionally want shown to a user.
10 years ago
Mark McLoughlin 23c566e3e2 Misc pep8 fixes 10 years ago
Mark McLoughlin 81e8dc9033 pep8 fixes for toplevel package
Otherwise we get e.g.

  F401 'RPCClient' imported but unused
10 years ago
Mark McLoughlin ee0e546150 Some error handling improvements 10 years ago
Mark McLoughlin 20f19d1c70 Recommend wrapping the client class rather than subclassing
Based on Doug's comments in:

  https://github.com/markmc/oslo-incubator/pull/6
10 years ago
Mark McLoughlin b2d6dcd2ef Document how to use RPCClient directly 10 years ago
Mark McLoughlin f67c090277 Document the public RPC API
I think I've covered everything that's public, which actually turns out
not to be a whole lot.

Still need to document the notifications API.
10 years ago
Mark McLoughlin e6a237d766 Fix defaults for client.prepare() args
None is a legitimate value to pass in for any of these args, so use a
marker object to distinguish between None and "no value supplied".
10 years ago
Mark McLoughlin 5d34b37109 Fix client.cast() typo 10 years ago
Mark McLoughlin b928fb64e0 Fix version_cap typo 10 years ago
Mark McLoughlin 69233f8b65 Allow all target attributes in client.prepare()
There's really no reason not to - you could have a single client object
invoking methods on a variety of different targets so long as they're
all available via the same transport.
10 years ago
Mark McLoughlin c2c2e17f25 Expose Serializer from top-level namespace
I guess the idea is that users of the API shouldn't have to import
specific modules other than I/O framework specific modules.
10 years ago
Mark McLoughlin 7cf7b386c8 Allow specifying a serializer when creating a server
Since the dispatcher class isn't public, we need to allow this to be passed via
the server constructor.
10 years ago
Mark McLoughlin 65d985053c Make endpoint.target optional
If an endpoint has no target set, or if it is set to None, just act
like the target is Target(namespace=None, version='1.0')

Also, refactor the dispatcher's inspection of endpoints a little.
10 years ago
Mark McLoughlin 5b654345c8 Dispatch methods in their own greenthreads
This mimics what we do with amqp.ProxyCallback.

It might be nice to have errors like "no such method" and "unspupported
version" raised before spawning a greenthread, but that would mean
either turning the dispatcher into a two step lookup/invoke interface or
having I/O framework specific dispatchers.
10 years ago
Mark McLoughlin b44541e617 Make rpc.dispatcher private
This is just an implementation detail of the public EventletRPCServer
and BlockingRPCServer classes.

This is important because I'm not sure we've got the right separation
of concerns between executors and dispatchers yet:

  http://lists.openstack.org/pipermail/openstack-dev/2013-June/009934.html

  That implies that you need to pair a tulip-aware executor with a
  tulip-aware dispatcher. We'll probably need to do something similar for
  eventlet too.

I think we need the RPC dispatcher to just know about RPC specific stuff
and there's a single abstraction for I/O framework integration.
10 years ago
Mark McLoughlin 101846c71b Make the base RPCServer class private
There's no point in this being public since the executor interface is
private.
10 years ago
Mark McLoughlin b517d42687 Fix typo with the serializer work 10 years ago
Doug Hellmann 0f620045db Update use of stevedore
Use the NamedExtensionManager instead of the DriverManager,
since we have multiple notification drivers.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
10 years ago
Mark McLoughlin a81e840cd5 Require topics and target in notify driver constructors
Pointed out by Doug.
10 years ago
Mark McLoughlin 4ede9a9178 Add generic serialization support
Copy across Dan Smith's work in commit 93ee6e3.
10 years ago
Mark McLoughlin 952f82e197 Support namespace in RPCClient.prepare()
Noticed we were missing this when comstud added the opposite support to
RpcProxy in commit df7ea83.
10 years ago
Flaper Fesp ff2c04834f Add parse_url to _utils.
The patch adds parse_url to _utils as an attempt to find a common url
format that satisfies most drivers needs. The code isn't definitive but
instead the beginning for further discussions. Current code parses
transport urls like this:

qpid://test/test
{'exchange': 'test',
 'hosts': [{'host': 'test', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://test:port/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port
{'exchange': None,
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,test2:port2/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2',
            'password': 'password',
            'username': 'username'}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2', 'password': '', 'username': ''}],
 'parameters': {},
 'transport': 'qpid'}

qpid://username:password@test:port,:@test2:port2/test?option=value
{'exchange': 'test',
 'hosts': [{'host': 'test:port',
            'password': 'password',
            'username': 'username'},
           {'host': 'test2:port2', 'password': '', 'username': ''}],
 'parameters': {'option': ['value']},
 'transport': 'qpid'}
10 years ago
Mark McLoughlin d559a86ec9 Remove entry point lists from the public API
Before the move to pbr, I thought it would be cute to include the lists
of entry points in the public API. After pbr, the entry points are only
in a config file, so it doesn't make much sense.
10 years ago
Russell Bryant ab26987133 Support capping message versions in the client.
When doing a rolling upgrade, we need to be able to tell all rpc clients
to hold off on sending newer versions of messages until all nodes
understand the new message version.  This patch adds the oslo component
of this.

It's quite simple.  The rpc proxy just stores the version cap and will
raise an exception if code ever tries to send a message that exceeds
this cap.

Allowing the cap to be configured and generating different types of
messages based on the configured value is the hard part here, but that
is left up to the project using the rpc library.

Implements blueprint rpc-version-control.
10 years ago
Mark McLoughlin 704f2c3319 Fix RPCClient check_for_lock()
Missing self parameter. Also no need for the return value.
10 years ago
Mark McLoughlin e8429af763 First cut at the notifier API
See:

  https://wiki.openstack.org/wiki/Oslo/Messaging#Emitting_Notifications
10 years ago
Mark McLoughlin 48a1cfae8a Add some notes 10 years ago