From ab9a9d4f860a53f6d106fa49eff33d7e1fc972c2 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Fri, 4 May 2018 15:45:33 -0400 Subject: [PATCH] Change metadata agent to log message after failure If the metadata 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 (on 30 second intervals) 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: I7a826811a889c618a39a8a91c8157e1805a327eb --- neutron/agent/metadata/agent.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index ef447559509..30e5bc68f17 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -240,6 +240,7 @@ class UnixDomainMetadataProxy(object): def _init_state_reporting(self): self.context = context.get_admin_context_without_session() + self.failed_state_report = False self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) self.agent_state = { 'binary': 'neutron-metadata-agent', @@ -272,8 +273,12 @@ class UnixDomainMetadataProxy(object): self.heartbeat.stop() return except Exception: + self.failed_state_report = True LOG.exception("Failed reporting state!") return + if self.failed_state_report: + self.failed_state_report = False + LOG.info('Successfully reported state after a previous failure.') self.agent_state.pop('start_flag', None) def _get_socket_mode(self):