Scope secgroup rpc api using a messaging namespace

This patch scopes the agent to plugin security group rpc 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: Iaee934646c9da7d32968406a583a5718fffc893b
This commit is contained in:
Russell Bryant 2015-01-22 15:03:19 -05:00
parent f2a7acdbd2
commit 8f6e93ea7d
3 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from oslo import messaging
from oslo.utils import importutils
from neutron.agent import firewall
from neutron.common import constants
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.i18n import _LI, _LW
@ -95,7 +96,8 @@ class SecurityGroupServerRpcApi(object):
doc/source/devref/rpc_api.rst.
"""
def __init__(self, topic):
target = messaging.Target(topic=topic, version='1.0')
target = messaging.Target(topic=topic, version='1.0',
namespace=constants.RPC_NAMESPACE_SECGROUP)
self.client = n_rpc.get_client(target)
def security_group_rules_for_devices(self, context, devices):

View File

@ -14,6 +14,7 @@
from oslo import messaging
from neutron.common import constants
from neutron import manager
@ -36,7 +37,8 @@ class SecurityGroupServerRpcCallback(object):
# NOTE: target must not be overridden in subclasses
# to keep RPC API version consistent across plugins.
target = messaging.Target(version='1.2')
target = messaging.Target(version='1.2',
namespace=constants.RPC_NAMESPACE_SECGROUP)
@property
def plugin(self):

View File

@ -149,3 +149,5 @@ 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_NAMESPACE_SECGROUP = 'secgroup'