diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index b8e6b27d58e..6b725974c5d 100644 --- a/neutron/agent/rpc.py +++ b/neutron/agent/rpc.py @@ -83,14 +83,14 @@ class PluginReportStateAPI(object): target = oslo_messaging.Target(topic=topic, version='1.2', namespace=constants.RPC_NAMESPACE_STATE) self.client = lib_rpc.get_client(target) + self.timeout = cfg.CONF.AGENT.report_interval def has_alive_neutron_server(self, context, **kwargs): cctxt = self.client.prepare() return cctxt.call(context, 'has_alive_neutron_server', **kwargs) def report_state(self, context, agent_state, use_call=False): - cctxt = self.client.prepare( - timeout=lib_rpc.TRANSPORT.conf.rpc_response_timeout) + cctxt = self.client.prepare(timeout=self.timeout) # add unique identifier to a report # that can be logged on server side. # This create visible correspondence between events on diff --git a/neutron/tests/unit/agent/test_rpc.py b/neutron/tests/unit/agent/test_rpc.py index c22506c077a..b595822fd8b 100644 --- a/neutron/tests/unit/agent/test_rpc.py +++ b/neutron/tests/unit/agent/test_rpc.py @@ -75,6 +75,11 @@ class AgentRPCPluginApi(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): topic = 'test' reportStateAPI = rpc.PluginReportStateAPI(topic) diff --git a/releasenotes/notes/set-report_state-rpc-timeout-to-report_interval-1265a70b0728e08c.yaml b/releasenotes/notes/set-report_state-rpc-timeout-to-report_interval-1265a70b0728e08c.yaml new file mode 100644 index 00000000000..300deca3aa0 --- /dev/null +++ b/releasenotes/notes/set-report_state-rpc-timeout-to-report_interval-1265a70b0728e08c.yaml @@ -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 `_.