From 7320817799527a093c573b95f0cf434d7fd5cc92 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 28 Oct 2021 11:36:55 -0400 Subject: [PATCH] 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 --- nova/api/metadata/handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index 049935bc4153..f7521839214c 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -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: