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
This commit is contained in:
parent
3aac42b3c7
commit
dbe04a40e5
|
@ -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],
|
||||
|
|
Loading…
Reference in New Issue