Log failed metadata retrievals

In our cloud environments, we're observing a weird issue where
this function is returning `None` for systems that are already
running and exist.

Due to the fact that it returns `None` right away, we don't
actually get a reason as to why the request failed and it is
returning a 404.

This should not clobber up the logs much more, due to the fact
that if you are sending a request to the metadata service, you're
supposed to already exist, so not being able to find the metadata
for an instance seems like a broken case.

This patch should help operators at least uncover why exactly
their instances are failing to get the metadata to further
troubleshoot.

Change-Id: Iadca69fee24ec89408f9fca68d1da46c918577bc
This commit is contained in:
Mohammed Naser 2021-10-28 11:36:55 -04:00
parent 171138146a
commit 7320817799
1 changed files with 1 additions and 0 deletions

View File

@ -70,6 +70,7 @@ class MetadataRequestHandler(wsgi.Application):
try:
data = base.get_metadata_by_address(address)
except exception.NotFound:
LOG.exception('Failed to get metadata for IP %s', address)
return None
if CONF.api.metadata_cache_expiration > 0: