From: Russell Bryant Date: Fri, 23 Jan 2015 19:48:07 +0000 (-0500) Subject: Scope dvr rpc api using a messaging namespace X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8c2423c9847dd18e6d7cf983022d7984c237645b;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/api/rpc/handlers/dvr_rpc.py b/neutron/api/rpc/handlers/dvr_rpc.py index c59f37f4e..fb0e083b5 100644 --- a/neutron/api/rpc/handlers/dvr_rpc.py +++ b/neutron/api/rpc/handlers/dvr_rpc.py @@ -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): diff --git a/neutron/common/constants.py b/neutron/common/constants.py index 7aafcb176..26d6724bd 100644 --- a/neutron/common/constants.py +++ b/neutron/common/constants.py @@ -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'