]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop RpcProxy usage from nec plugin
authorRussell Bryant <rbryant@redhat.com>
Sun, 23 Nov 2014 02:25:59 +0000 (02:25 +0000)
committerRussell Bryant <rbryant@redhat.com>
Mon, 24 Nov 2014 21:01:42 +0000 (21:01 +0000)
This patch removes the usage of the RpcProxy compatibility class from
the nec plugin.  The equivalent usage of oslo.messaging APIs is now
used instead.

Part of blueprint drop-rpc-compat.

Change-Id: I0b3ee1437ad4525f1354caaba686b6ab7442db2f

neutron/plugins/nec/agent/nec_neutron_agent.py
neutron/plugins/nec/nec_plugin.py

index 1623bfa8abc68b092ff60dc8c32b8931527ce235..787a8186e1c72e0192fb13fdc40020bed0b61923 100755 (executable)
@@ -25,6 +25,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
@@ -80,12 +82,12 @@ class NECAgentRpcCallback(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 833d6e17261840e76f7d1d1eed5f1b03e0216341..1845c688de43b56098b4e3af2f009c9d654656d9 100644 (file)
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from oslo import messaging
+
 from neutron.agent import securitygroups_rpc as sg_rpc
 from neutron.api import extensions as neutron_extensions
 from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
@@ -671,23 +673,19 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
         self.notify_security_groups_member_updated(context, port)
 
 
-class NECPluginV2AgentNotifierApi(n_rpc.RpcProxy,
-                                  sg_rpc.SecurityGroupAgentRpcApiMixin):
+class NECPluginV2AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
     '''RPC API for NEC plugin agent.'''
 
-    BASE_RPC_API_VERSION = '1.0'
-
     def __init__(self, topic):
-        super(NECPluginV2AgentNotifierApi, 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 NECPluginV2RPCCallbacks(n_rpc.RpcCallback):