]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop RpcProxy usage from metering_agent
authorRussell Bryant <rbryant@redhat.com>
Tue, 18 Nov 2014 20:25:12 +0000 (20:25 +0000)
committerRussell Bryant <rbryant@redhat.com>
Fri, 21 Nov 2014 13:39:58 +0000 (13:39 +0000)
Drop one more use of the RpcProxy compatibility class in favor of
direct use of oslo.messaging APIs.

Part of blueprint drop-rpc-compat.

Change-Id: I3c68aa246d88447f793aa9890f10f5043a41338d

neutron/services/metering/agents/metering_agent.py

index c860bdb93b889307e100a3a59a2c0e0f21e6a74a..168af42cb79dd4ad931c7170f73c3fb9459acd94 100644 (file)
@@ -19,6 +19,7 @@ import eventlet
 eventlet.monkey_patch()
 
 from oslo.config import cfg
+from oslo import messaging
 
 from neutron.agent.common import config
 from neutron.agent import rpc as agent_rpc
@@ -40,21 +41,17 @@ from neutron import service as neutron_service
 LOG = logging.getLogger(__name__)
 
 
-class MeteringPluginRpc(n_rpc.RpcProxy):
-
-    BASE_RPC_API_VERSION = '1.0'
+class MeteringPluginRpc(object):
 
     def __init__(self, host):
-        super(MeteringPluginRpc,
-              self).__init__(topic=topics.METERING_AGENT,
-                             default_version=self.BASE_RPC_API_VERSION)
+        target = messaging.Target(topic=topics.METERING_PLUGIN, version='1.0')
+        self.client = n_rpc.get_client(target)
 
     def _get_sync_data_metering(self, context):
         try:
-            return self.call(context,
-                             self.make_msg('get_sync_data_metering',
-                                           host=self.host),
-                             topic=topics.METERING_PLUGIN)
+            cctxt = self.client.prepare()
+            return cctxt.call(context, 'get_sync_data_metering',
+                              host=self.host)
         except Exception:
             LOG.exception(_("Failed synchronizing routers"))