Change SR-IOV agent to log message after failure

If the SR-IOV 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: I0782599a4f0ffe48c2dd4fa2abc9fe5111715c0c
This commit is contained in:
Brian Haley 2019-01-24 16:23:29 -05:00 committed by Brian Haley
parent 2de3aea25b
commit 2147c70745
1 changed files with 6 additions and 0 deletions

View File

@ -159,6 +159,7 @@ class SriovNicSwitchAgent(object):
LOG.info("RPC agent_id: %s", self.agent_id)
self.topic = topics.AGENT
self.failed_report_state = False
self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
# RPC network init
# Handle updates from service
@ -188,7 +189,12 @@ class SriovNicSwitchAgent(object):
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 _create_agent_extension_manager(self, connection):
ext_manager.register_opts(self.conf)