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
This commit is contained in:
Brian Haley
2018-05-04 15:45:33 -04:00
parent 805359d9a2
commit ab9a9d4f86
+5
View File
@@ -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):