]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Scope dvr rpc api using a messaging namespace
authorRussell Bryant <rbryant@redhat.com>
Fri, 23 Jan 2015 19:48:07 +0000 (14:48 -0500)
committerRussell Bryant <rbryant@redhat.com>
Tue, 10 Feb 2015 19:07:29 +0000 (14:07 -0500)
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

neutron/api/rpc/handlers/dvr_rpc.py
neutron/common/constants.py

index c59f37f4ef545444fa4be2a703c8ac65fa479057..fb0e083b5159e7ce1148ac2c16047b1682424bce 100644 (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):
index 7aafcb17698017805316ac6b11b7c9b69b637f4f..26d6724bd784a5b5d08e34a6d3ae7154efb723d5 100644 (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'