Scope metadata 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 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
This commit is contained in:
Russell Bryant 2014-12-18 20:11:07 +00:00
parent bc686f530e
commit caedc3ee05
3 changed files with 24 additions and 4 deletions

View 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):

View File

@ -15,14 +15,23 @@
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):

View 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'