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

Note that there is one very minor functional change included.  The
previous code set the base version to '1.1'.  It should be '1.0'.  The
proper pattern to use is to set the base version on the client side to
be the initial version of the API (X.0).  Then, any methods that
require a newer version need to specify it.

Part of blueprint drop-rpc-compat.

Change-Id: I6cc343c1e88d666dd90842e5da36787b6693fc98

neutron/plugins/brocade/NeutronPlugin.py

index a1ba20ba53ede8f5731ed9eab2284db0e5657d33..267c9ca7ee1b78e6e20eba2a2d13404e494dd29d 100644 (file)
@@ -164,8 +164,7 @@ class SecurityGroupServerRpcMixin(sg_db_rpc.SecurityGroupServerRpcMixin):
         return port
 
 
-class AgentNotifierApi(n_rpc.RpcProxy,
-                       sg_rpc.SecurityGroupAgentRpcApiMixin):
+class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin):
     """Agent side of the linux bridge rpc API.
 
     API version history:
@@ -175,12 +174,10 @@ class AgentNotifierApi(n_rpc.RpcProxy,
 
     """
 
-    BASE_RPC_API_VERSION = '1.1'
-
     def __init__(self, topic):
-        super(AgentNotifierApi, self).__init__(
-            topic=topic, default_version=self.BASE_RPC_API_VERSION)
         self.topic = topic
+        target = messaging.Target(topic=topic, version='1.0')
+        self.client = n_rpc.get_client(target)
         self.topic_network_delete = topics.get_topic_name(topic,
                                                           topics.NETWORK,
                                                           topics.DELETE)
@@ -189,18 +186,14 @@ class AgentNotifierApi(n_rpc.RpcProxy,
                                                        topics.UPDATE)
 
     def network_delete(self, context, network_id):
-        self.fanout_cast(context,
-                         self.make_msg('network_delete',
-                                       network_id=network_id),
-                         topic=self.topic_network_delete)
+        cctxt = self.client.prepare(topic=self.topic_network_delete,
+                                    fanout=True)
+        cctxt.cast(context, 'network_delete', network_id=network_id)
 
     def port_update(self, context, port, physical_network, vlan_id):
-        self.fanout_cast(context,
-                         self.make_msg('port_update',
-                                       port=port,
-                                       physical_network=physical_network,
-                                       vlan_id=vlan_id),
-                         topic=self.topic_port_update)
+        cctxt = self.client.prepare(topic=self.topic_port_update, fanout=True)
+        cctxt.cast(context, 'port_update', port=port,
+                   physical_network=physical_network, vlan_id=vlan_id)
 
 
 class BrocadePluginV2(db_base_plugin_v2.NeutronDbPluginV2,