Set RPC timeout in PluginReportStateAPI to report_interval
See more details on why this is need in the referenced bug #1948676 Change-Id: I8a95e80ca74edc8f8f394cefc749c4065a8e0575 Closes-Bug: #1948676 (cherry picked from commit7d552848c2
) (cherry picked from commit551d36362a
) (cherry picked from commit7f9a3f3293
)
This commit is contained in:
parent
40f2ec340c
commit
ee62d5b01a
|
@ -82,14 +82,14 @@ class PluginReportStateAPI(object):
|
||||||
target = oslo_messaging.Target(topic=topic, version='1.2',
|
target = oslo_messaging.Target(topic=topic, version='1.2',
|
||||||
namespace=constants.RPC_NAMESPACE_STATE)
|
namespace=constants.RPC_NAMESPACE_STATE)
|
||||||
self.client = lib_rpc.get_client(target)
|
self.client = lib_rpc.get_client(target)
|
||||||
|
self.timeout = cfg.CONF.AGENT.report_interval
|
||||||
|
|
||||||
def has_alive_neutron_server(self, context, **kwargs):
|
def has_alive_neutron_server(self, context, **kwargs):
|
||||||
cctxt = self.client.prepare()
|
cctxt = self.client.prepare()
|
||||||
return cctxt.call(context, 'has_alive_neutron_server', **kwargs)
|
return cctxt.call(context, 'has_alive_neutron_server', **kwargs)
|
||||||
|
|
||||||
def report_state(self, context, agent_state, use_call=False):
|
def report_state(self, context, agent_state, use_call=False):
|
||||||
cctxt = self.client.prepare(
|
cctxt = self.client.prepare(timeout=self.timeout)
|
||||||
timeout=lib_rpc.TRANSPORT.conf.rpc_response_timeout)
|
|
||||||
# add unique identifier to a report
|
# add unique identifier to a report
|
||||||
# that can be logged on server side.
|
# that can be logged on server side.
|
||||||
# This create visible correspondence between events on
|
# This create visible correspondence between events on
|
||||||
|
|
|
@ -75,6 +75,11 @@ class AgentRPCPluginApi(base.BaseTestCase):
|
||||||
|
|
||||||
|
|
||||||
class AgentPluginReportState(base.BaseTestCase):
|
class AgentPluginReportState(base.BaseTestCase):
|
||||||
|
def test_plugin_report_state_timeout_report_interval(self):
|
||||||
|
cfg.CONF.set_override('report_interval', 15, 'AGENT')
|
||||||
|
reportStateAPI = rpc.PluginReportStateAPI('test')
|
||||||
|
self.assertEqual(reportStateAPI.timeout, 15)
|
||||||
|
|
||||||
def test_plugin_report_state_use_call(self):
|
def test_plugin_report_state_use_call(self):
|
||||||
topic = 'test'
|
topic = 'test'
|
||||||
reportStateAPI = rpc.PluginReportStateAPI(topic)
|
reportStateAPI = rpc.PluginReportStateAPI(topic)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The agent reporting state to the server now uses a RPC timeout set to
|
||||||
|
the report_interval configuration option value. See `1948676 <https://bugs.launchpad.net/neutron/+bug/1948676>`_.
|
Loading…
Reference in New Issue