Merge "Change DHCP agent to log message after failure"

This commit is contained in:
Zuul 2019-01-29 09:00:07 +00:00 committed by Gerrit Code Review
commit 7c152a80cc
1 changed files with 5 additions and 0 deletions

View File

@ -781,6 +781,7 @@ class DhcpAgentWithStateReport(DhcpAgent):
def __init__(self, host=None, conf=None):
super(DhcpAgentWithStateReport, self).__init__(host=host, conf=conf)
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
self.failed_report_state = False
self.agent_state = {
'binary': 'neutron-dhcp-agent',
'host': host,
@ -817,8 +818,12 @@ class DhcpAgentWithStateReport(DhcpAgent):
self.run()
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.")
if self.agent_state.pop('start_flag', None):
self.run()