Fix missing X-OpenStack-Request-ID header

Request ID is essential in operating OpenStack services, especially
when troubleshooting some API problems. It allows us to find out
the log lines actually related to a specific request.

However watcher api hasn't returned it properly, so operators had no
way to determine the exact ID they should search.

Add RequestID middleware to return the id in X-OpenStack-Request-Id
header, which is globally used.

Closes-Bug: #2122350
Change-Id: Ie4a8307e8e7e981cedbeaf5fe731dbd47a50bade
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-09-09 02:04:40 +09:00
parent b1aad46209
commit a562880b1c
4 changed files with 23 additions and 1 deletions

View File

@@ -24,6 +24,12 @@ class TestRoot(base.FunctionalTest):
# Check fields are not empty
[self.assertNotIn(f, ['', []]) for f in data.keys()]
# NOTE(tkajinam): Request ID should be present in any request so we verify
# it only at the root path.
def test_request_id(self):
resp = self.get_json('/', path_prefix='', return_json=False)
self.assertIn('X-OpenStack-Request-Id', resp.headers)
class TestV1Root(base.FunctionalTest):