Log request IDs for matched Nova external events

Nova notifier logs for external events only provide the event
details without showing its connection to the associated request_id.

That complicates debugging of corner cases for external events as we
cannot be sure to which exact request a logged event is related.

Make the matching request_ids logged alongside external event
details, whenever it is available.

Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Change-Id: I047a28744a0bf52ace9f9a205993c6037a21083c
(cherry picked from commit 7cedbdeaba)
This commit is contained in:
Bogdan Dobrelya 2022-02-10 11:32:06 +01:00
parent ca458d9eb9
commit 5aac511914
1 changed files with 8 additions and 4 deletions

View File

@ -291,11 +291,15 @@ class Notifier(object):
except KeyError:
response_error = True
continue
if code != 200:
LOG.warning("Nova event: %s returned with failed "
"status", event)
if hasattr(response, 'request_ids'):
msg = "Nova event matching {}".format(response.request_ids)
else:
LOG.info("Nova event response: %s", event)
msg = "Nova event"
if code != 200:
LOG.warning("%s: %s returned with failed "
"status", msg, event)
else:
LOG.info("%s response: %s", msg, event)
if response_error:
LOG.error("Error response returned from nova: %s",
response)