Skip to content

Commit

Permalink
Drop RpcProxy usage from metering_agent
Browse files Browse the repository at this point in the history
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
  • Loading branch information
russellb committed Nov 21, 2014
1 parent fb78f69 commit bdcc5a4
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions neutron/services/metering/agents/metering_agent.py
Expand Up @@ -19,6 +19,7 @@
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
Expand All @@ -40,21 +41,17 @@
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"))

Expand Down

0 comments on commit bdcc5a4

Please sign in to comment.