Change L3 agent to log message after failure

If the L3 agent 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: I9019782588caffcb647cf1fd557f76ce89cea254
This commit is contained in:
Brian Haley 2019-01-24 16:13:16 -05:00
parent d519934c77
commit a78bf152b1
1 changed files with 6 additions and 0 deletions

View File

@ -769,6 +769,7 @@ class L3NATAgentWithStateReport(L3NATAgent):
def __init__(self, host, conf=None):
super(L3NATAgentWithStateReport, self).__init__(host=host, conf=conf)
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
self.failed_report_state = False
self.agent_state = {
'binary': 'neutron-l3-agent',
'host': host,
@ -826,7 +827,12 @@ class L3NATAgentWithStateReport(L3NATAgent):
self.heartbeat.stop()
return
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 after_start(self):
eventlet.spawn_n(self._process_routers_loop)