From dbe04a40e5819f7bf145e98735a3cd549dd3576d Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Thu, 24 Jan 2019 16:25:46 -0500 Subject: [PATCH] Change common agent code to log message after failure If an agent using the common agent code fails to send its report_state to the server, it logs an exception: Failed reporting state!: MessagingTimeout: Timed out... If it then tries a second time and succeeds it just goes on happily. It would be nice if it logged that it had success on the subsequent attempt so someone looking at the logs know it recovered. Change-Id: Ie94e909fba07e5eb91b57160947edc9b86428fe5 --- neutron/plugins/ml2/drivers/agent/_common_agent.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neutron/plugins/ml2/drivers/agent/_common_agent.py b/neutron/plugins/ml2/drivers/agent/_common_agent.py index 28440902981..01d1ce7ec2e 100644 --- a/neutron/plugins/ml2/drivers/agent/_common_agent.py +++ b/neutron/plugins/ml2/drivers/agent/_common_agent.py @@ -89,6 +89,7 @@ class CommonAgentLoop(service.Service): configurations = {'extensions': self.ext_manager.names()} configurations.update(self.mgr.get_agent_configurations()) + self.failed_report_state = False # TODO(mangelajo): optimize resource_versions (see ovs agent) self.agent_state = { 'binary': self.agent_binary, @@ -136,7 +137,12 @@ class CommonAgentLoop(service.Service): self.agent_state.pop('resource_versions', None) self.agent_state.pop('start_flag', None) except Exception: + self.failed_report_state = True LOG.exception("Failed reporting state!") + return + if self.failed_report_state: + self.failed_report_state = False + LOG.info("Successfully reported state after a previous failure.") def _validate_rpc_endpoints(self): if not isinstance(self.endpoints[0],