]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Scope metadata rpc api using a messaging namespace
authorRussell Bryant <rbryant@redhat.com>
Thu, 18 Dec 2014 20:11:07 +0000 (20:11 +0000)
committerRussell Bryant <rbryant@redhat.com>
Fri, 9 Jan 2015 16:21:01 +0000 (11:21 -0500)
This patch does a couple of things.  First it adds docstrings to the
client/server pair of the rpc interface used by the metadata service
to make 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: I3330229bf85b01d50c90e9ca064ae5e0fae83509

neutron/agent/metadata/agent.py
neutron/api/rpc/handlers/metadata_rpc.py
neutron/common/constants.py

index fef96e92ddf9e9accf046813ade4de1e81f52dba..06c68ac7473b8626bb3b607769b7da238fe619d0 100644 (file)
@@ -47,14 +47,23 @@ LOG = logging.getLogger(__name__)
 
 
 class MetadataPluginAPI(object):
-    """Agent-side RPC (stub) for agent-to-plugin interaction.
+    """Agent-side RPC for metadata agent-to-plugin interaction.
+
+    This class implements the client side of an rpc interface used by the
+    metadata service to make calls back into the Neutron plugin.  The server
+    side is defined in
+    neutron.api.rpc.handlers.metadata_rpc.MetadataRpcCallback.  For more
+    information about changing rpc interfaces, see
+    doc/source/devref/rpc_api.rst.
 
     API version history:
         1.0 - Initial version.
     """
 
     def __init__(self, topic):
-        target = messaging.Target(topic=topic, version='1.0')
+        target = messaging.Target(topic=topic,
+                                  namespace=n_const.RPC_NAMESPACE_METADATA,
+                                  version='1.0')
         self.client = n_rpc.get_client(target)
 
     def get_ports(self, context, filters):
index acd59610caa8a7c233c830469a211727c33dd43e..c8533b65271f4f804671de29e9243fac557062cd 100644 (file)
 
 from oslo import messaging
 
+from neutron.common import constants
 from neutron import manager
 
 
 class MetadataRpcCallback(object):
-    """Metadata agent RPC callback in plugin implementations."""
+    """Metadata agent RPC callback in plugin implementations.
+
+    This class implements the server side of an rpc interface used by the
+    metadata service to make calls back into the Neutron plugin.  The client
+    side is defined in neutron.agent.metadata.agent.MetadataPluginAPI.  For
+    more information about changing rpc interfaces, see
+    doc/source/devref/rpc_api.rst.
+    """
 
     # 1.0  MetadataPluginAPI BASE_RPC_API_VERSION
-    target = messaging.Target(version='1.0')
+    target = messaging.Target(version='1.0',
+                              namespace=constants.RPC_NAMESPACE_METADATA)
 
     @property
     def plugin(self):
index bdaac61a01772d7b138e568d5338587d141a5db6..c70773b85e60d6e89c29dcab2474c8ded0606322 100644 (file)
@@ -145,3 +145,5 @@ DB_INTEGER_MAX_VALUE = 2 ** 31 - 1
 
 # RPC Interface for agents to call DHCP API implemented on the plugin side
 RPC_NAMESPACE_DHCP_PLUGIN = 'dhcp'
+# RPC interface for the metadata service to get info from the plugin side
+RPC_NAMESPACE_METADATA = 'metadata'