From d0eb47046b855fc02cd4a080808f0bcab75e8549 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 20 Nov 2014 22:22:41 +0000 Subject: [PATCH] Drop RpcProxy usage from bigswitch plugin This patch drops the usage of the RpcProxy compatibility class from the bigswitch 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. In this case, verison '1.1' was the security group methods, and those specify '1.1' as you would expect. Part of blueprint drop-rpc-compat. Change-Id: I695d2a26db9c01b0be65b11cd4e4063567b5f20d --- neutron/plugins/bigswitch/plugin.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index 52b32de48..e3c4febc9 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -47,6 +47,7 @@ import re import eventlet from oslo.config import cfg +from oslo import messaging from sqlalchemy.orm import exc as sqlexc from neutron.agent import securitygroups_rpc as sg_rpc @@ -92,22 +93,18 @@ SYNTAX_ERROR_MESSAGE = _('Syntax error in server config file, aborting plugin') METADATA_SERVER_IP = '169.254.169.254' -class AgentNotifierApi(n_rpc.RpcProxy, - sg_rpc.SecurityGroupAgentRpcApiMixin): - - BASE_RPC_API_VERSION = '1.1' +class AgentNotifierApi(sg_rpc.SecurityGroupAgentRpcApiMixin): def __init__(self, topic): - super(AgentNotifierApi, self).__init__( - topic=topic, default_version=self.BASE_RPC_API_VERSION) - self.topic_port_update = topics.get_topic_name( - topic, topics.PORT, topics.UPDATE) + self.topic = topic + 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) + topic_port_update = topics.get_topic_name(self.client.target.topic, + topics.PORT, topics.UPDATE) + cctxt = self.client.prepare(fanout=True, topic=topic_port_update) + cctxt.cast(context, 'port_update', port=port) class SecurityGroupServerRpcMixin(sg_db_rpc.SecurityGroupServerRpcMixin): -- 2.45.2