Drop RpcProxy usage from metering_agent
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
This commit is contained in:
parent
fb78f697d9
commit
bdcc5a46d7
|
@ -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"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue