]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop RpcProxy usage from oneconvergence plugin
authorRussell Bryant <rbryant@redhat.com>
Sun, 23 Nov 2014 02:37:46 +0000 (02:37 +0000)
committerRussell Bryant <rbryant@redhat.com>
Wed, 26 Nov 2014 15:55:42 +0000 (15:55 +0000)
This patch removes usage of the RpcProxy compatibility class from the
oneconvergence plugin.  The equivalent usage of oslo.messaging APIs is
now used intead.

Part of blueprint drop-rpc-compat.

Change-Id: Ifa74849ba9e3dc09cbb8cb3a723aeaa2b25b87ad

neutron/plugins/oneconvergence/agent/nvsd_neutron_agent.py
neutron/plugins/oneconvergence/plugin.py

index fb19978ea83daab19e5aaa468492e879f5acd270..5bac0646ca8e7d551d441162687d9c68b9c85dfb 100644 (file)
@@ -21,6 +21,8 @@ import time
 import eventlet
 eventlet.monkey_patch()
 
+from oslo import messaging
+
 from neutron.agent.linux import ovs_lib
 from neutron.agent import rpc as agent_rpc
 from neutron.agent import securitygroups_rpc as sg_rpc
@@ -57,11 +59,12 @@ class NVSDAgentRpcCallback(n_rpc.RpcCallback):
             self.sg_agent.refresh_firewall()
 
 
-class SecurityGroupServerRpcApi(n_rpc.RpcProxy,
-                                sg_rpc.SecurityGroupServerRpcApiMixin):
+class SecurityGroupServerRpcApi(sg_rpc.SecurityGroupServerRpcApiMixin):
+
     def __init__(self, topic):
-        super(SecurityGroupServerRpcApi, self).__init__(
-            topic=topic, default_version=sg_rpc.SG_RPC_VERSION)
+        self.topic = topic
+        target = messaging.Target(topic=topic, version=sg_rpc.SG_RPC_VERSION)
+        self.client = n_rpc.get_client(target)
 
 
 class SecurityGroupAgentRpcCallback(
index 5b612c6f83c9c6078e46d17fdbe88f626c49032e..990753032cda18b1852a3c3f14ed74a848b3be30 100644 (file)
@@ -15,6 +15,7 @@
 """Implementation of OneConvergence Neutron Plugin."""
 
 from oslo.config import cfg
+from oslo import messaging
 from oslo.utils import excutils
 from oslo.utils import importutils
 
@@ -61,21 +62,18 @@ class SecurityGroupServerRpcMixin(sg_db_rpc.SecurityGroupServerRpcMixin):
         return port
 
 
-class NVSDPluginV2AgentNotifierApi(n_rpc.RpcProxy,
-                                   sg_rpc.SecurityGroupAgentRpcApiMixin):
-
-    BASE_RPC_API_VERSION = '1.0'
+class NVSDPluginV2AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
 
     def __init__(self, topic):
-        super(NVSDPluginV2AgentNotifierApi, self).__init__(
-            topic=topic, default_version=self.BASE_RPC_API_VERSION)
+        self.topic = topic
         self.topic_port_update = topics.get_topic_name(topic, topics.PORT,
                                                        topics.UPDATE)
+        target = messaging.Target(topic=topic, version='1.0')
+        self.client = n_rpc.get_client(target)
 
     def port_update(self, context, port):
-        self.fanout_cast(context,
-                         self.make_msg('port_update', port=port),
-                         topic=self.topic_port_update)
+        cctxt = self.client.prepare(topic=self.topic_port_update, fanout=True)
+        cctxt.cast(context, 'port_update', port=port)
 
 
 class OneConvergencePluginV2(db_base_plugin_v2.NeutronDbPluginV2,