]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Scope secgroup rpc api using a messaging namespace
authorRussell Bryant <rbryant@redhat.com>
Thu, 22 Jan 2015 20:03:19 +0000 (15:03 -0500)
committerRussell Bryant <rbryant@redhat.com>
Mon, 26 Jan 2015 13:07:36 +0000 (08:07 -0500)
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

neutron/agent/securitygroups_rpc.py
neutron/api/rpc/handlers/securitygroups_rpc.py
neutron/common/constants.py

index 9ecdf0fbd4b3009327ce84c765fb6bbb9eba735f..11f3e41a78b12c8d1bf16d701dbfd5a22f6a7810 100644 (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):
index ade7b0c05dc2ddd4c5a1d6528a91aa46307bcb16..e894450e84596b7d68707ed10970c7cd24539982 100644 (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):
index 54f671ba35b61059b0bff61ae7c1ea11ca0aaf90..7aafcb17698017805316ac6b11b7c9b69b637f4f 100644 (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'