From: Russell Bryant Date: Thu, 22 Jan 2015 20:03:19 +0000 (-0500) Subject: Scope secgroup rpc api using a messaging namespace X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8f6e93ea7d070715a14e80083a769c115fb1b62d;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index 9ecdf0fbd..11f3e41a7 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -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): diff --git a/neutron/api/rpc/handlers/securitygroups_rpc.py b/neutron/api/rpc/handlers/securitygroups_rpc.py index ade7b0c05..e894450e8 100644 --- a/neutron/api/rpc/handlers/securitygroups_rpc.py +++ b/neutron/api/rpc/handlers/securitygroups_rpc.py @@ -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): diff --git a/neutron/common/constants.py b/neutron/common/constants.py index 54f671ba3..7aafcb176 100644 --- a/neutron/common/constants.py +++ b/neutron/common/constants.py @@ -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'