Scope dvr rpc api using a messaging namespace

This patch does a couple of things.  First it adds docstrings to the
client/server pair of the rpc interface used by the ovs agent
to make dvr related calls back into the Neutron server.  The docs
tell you where the other side of the interface is found in the code,
and where docs are that give more info on the rules for changing them.

The second thing done in this patch is to scope this interface using a
messaging namespace.  Right now some plugins expose several interfaces
via the default namespace.  This effectively means they are a single
API and should be managed with a single version stream.  It's much
more managable to just treat these as separate interfaces and this
change makes that explicit and functionally true.  Now when a method
is invoked, the only classes considered for handling that request will
be ones marked with the right namespace.

Part of blueprint rpc-docs-and-namespaces.

Change-Id: Ieb1f023f5ab0ba66620d07e90005a49f1d40574c
This commit is contained in:
Russell Bryant 2015-01-23 14:48:07 -05:00
parent a97b9a4944
commit 8c2423c984
2 changed files with 20 additions and 5 deletions

View File

@ -15,6 +15,7 @@
import oslo_messaging
from neutron.common import constants
from neutron.common import log
from neutron.common import rpc as n_rpc
from neutron.common import topics
@ -25,10 +26,16 @@ LOG = logging.getLogger(__name__)
class DVRServerRpcApi(object):
"""Agent-side RPC (stub) for agent-to-plugin interaction."""
"""Agent-side RPC (stub) for agent-to-plugin interaction.
This class implements the client side of an rpc interface. The server side
can be found below: DVRServerRpcCallback. For more information on changing
rpc interfaces, see doc/source/devref/rpc_api.rst.
"""
def __init__(self, topic):
target = oslo_messaging.Target(topic=topic, version='1.0')
target = oslo_messaging.Target(topic=topic, version='1.0',
namespace=constants.RPC_NAMESPACE_DVR)
self.client = n_rpc.get_client(target)
@log.log
@ -54,12 +61,18 @@ class DVRServerRpcApi(object):
class DVRServerRpcCallback(object):
"""Plugin-side RPC (implementation) for agent-to-plugin interaction."""
"""Plugin-side RPC (implementation) for agent-to-plugin interaction.
This class implements the server side of an rpc interface. The client side
can be found above: DVRServerRpcApi. For more information on changing rpc
interfaces, see doc/source/devref/rpc_api.rst.
"""
# History
# 1.0 Initial version
target = oslo_messaging.Target(version='1.0')
target = oslo_messaging.Target(version='1.0',
namespace=constants.RPC_NAMESPACE_DVR)
@property
def plugin(self):

View File

@ -149,5 +149,7 @@ DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
RPC_NAMESPACE_DHCP_PLUGIN = 'dhcp'
# RPC interface for the metadata service to get info from the plugin side
RPC_NAMESPACE_METADATA = 'metadata'
# RPC interface for plugin to agent security group API
# RPC interface for agent to plugin security group API
RPC_NAMESPACE_SECGROUP = 'secgroup'
# RPC interface for agent to plugin DVR api
RPC_NAMESPACE_DVR = 'dvr'