From 2484a507472768b8515b7052ff44da546965dd65 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 21 Nov 2014 14:43:26 +0000 Subject: [PATCH] Drop RpcProxy usage from brocade plugin 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 | 25 +++++++++--------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index a1ba20ba5..267c9ca7e 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -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, -- 2.45.2