Previous topic

The nova.rpc.common Module

Next topic

The nova.rpc.impl_fake Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.rpc.dispatcher Module

Code for rpc message dispatching.

Messages that come in have a version number associated with them. RPC API version numbers are in the form:

Major.Minor

For a given message with version X.Y, the receiver must be marked as able to handle messages of version A.B, where:

A = X

B >= Y

The Major version number would be incremented for an almost completely new API. The Minor version number would be incremented for backwards compatible changes to an existing API. A backwards compatible change could be something like adding a new method, adding an argument to an existing method (but not requiring it), or changing the type for an existing argument (but still handling the old type as well).

The conversion over to a versioned API must be done on both the client side and server side of the API at the same time. However, as the code stands today, there can be both versioned and unversioned APIs implemented in the same code base.

class RpcDispatcher(callbacks)

Bases: object

Dispatch rpc messages according to the requested API version.

This class can be used as the top level ‘manager’ for a service. It contains a list of underlying managers that have an API_VERSION attribute.

dispatch(ctxt, version, method, **kwargs)

Dispatch a message based on a requested version.

Parameters:
  • ctxt – The request context
  • version – The requested API version from the incoming message
  • method – The method requested to be called by the incoming message.
  • kwargs – A dict of keyword arguments to be passed to the method.
Returns:

Whatever is returned by the underlying method that gets called.