summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorGorka Eguileor <geguileo@redhat.com>2022-02-04 12:42:25 +0100
committerGorka Eguileor <geguileo@redhat.com>2022-02-23 16:48:45 +0100
commit18b8033b6bd1945bd27b03b779a32a883df5fb10 (patch)
treee521066ba79e7ae153acaf87e49ed200c7a325b5 /etc
parent5b89039e9e51a429c6894e2b8791a3ee4fc338cd (diff)
downloadcinder-18b8033b6bd1945bd27b03b779a32a883df5fb10.tar.gz
Fix request id mess on Cinder-API
This patch fixes multiple issues related to request ids: - Duplicated request ID in logs - Missing request id header in response - Wrong request ID in response header when using noauth The source of these issues is the fact that the request ID and the request context are set too late, or not at all, in the paste filter chain. And the last bug is fixed as a freebie when the code in auth.py is refactored to reduce code duplication on setting the cinder.context key in the request's environment. The patch fixes these issue by changing the filter chains to have the request_id filter as the first filter, and using our own filter for it, to ensure that the context is correctly set. Not sure if values now defined in ENV_OVERWRITES are still necessary, so the patch preserves current behavior. Closes-Bug: #1960019 Closes-Bug: #1960020 Closes-Bug: #1960021 Closes-Bug: #1960329 Change-Id: Ide831a221a7561bbb7da193f0edb011f1989420e
Diffstat (limited to 'etc')
-rw-r--r--etc/cinder/api-paste.ini27
1 files changed, 15 insertions, 12 deletions
diff --git a/etc/cinder/api-paste.ini b/etc/cinder/api-paste.ini
index ce2e0ea98..cd3040e11 100644
--- a/etc/cinder/api-paste.ini
+++ b/etc/cinder/api-paste.ini
@@ -10,13 +10,10 @@ use = call:cinder.api:root_app_factory
[composite:openstack_volume_api_v3]
use = call:cinder.api.middleware.auth:pipeline_factory
-noauth = cors http_proxy_to_wsgi request_id faultwrap sizelimit osprofiler noauth apiv3
-noauth_include_project_id = cors http_proxy_to_wsgi request_id faultwrap sizelimit osprofiler noauth_include_project_id apiv3
-keystone = cors http_proxy_to_wsgi request_id faultwrap sizelimit osprofiler authtoken keystonecontext apiv3
-keystone_nolimit = cors http_proxy_to_wsgi request_id faultwrap sizelimit osprofiler authtoken keystonecontext apiv3
-
-[filter:request_id]
-paste.filter_factory = oslo_middleware.request_id:RequestId.factory
+noauth = request_id cors http_proxy_to_wsgi faultwrap sizelimit osprofiler noauth apiv3
+noauth_include_project_id = request_id cors http_proxy_to_wsgi faultwrap sizelimit osprofiler noauth_include_project_id apiv3
+keystone = request_id cors http_proxy_to_wsgi faultwrap sizelimit osprofiler authtoken keystonecontext apiv3
+keystone_nolimit = request_id cors http_proxy_to_wsgi faultwrap sizelimit osprofiler authtoken keystonecontext apiv3
[filter:http_proxy_to_wsgi]
paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory
@@ -44,11 +41,19 @@ paste.filter_factory = oslo_middleware.sizelimit:RequestBodySizeLimiter.factory
paste.app_factory = cinder.api.v3.router:APIRouter.factory
[pipeline:apiversions]
-pipeline = cors http_proxy_to_wsgi faultwrap osvolumeversionapp
+pipeline = request_id cors http_proxy_to_wsgi faultwrap osvolumeversionapp
[app:osvolumeversionapp]
paste.app_factory = cinder.api.versions:Versions.factory
+[pipeline:healthcheck]
+pipeline = request_id healthcheckapp
+
+[app:healthcheckapp]
+paste.app_factory = oslo_middleware:Healthcheck.app_factory
+backends = disable_by_file
+disable_by_file_path = /etc/cinder/healthcheck_disable
+
##########
# Shared #
##########
@@ -59,7 +64,5 @@ paste.filter_factory = cinder.api.middleware.auth:CinderKeystoneContext.factory
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
-[app:healthcheck]
-paste.app_factory = oslo_middleware:Healthcheck.app_factory
-backends = disable_by_file
-disable_by_file_path = /etc/cinder/healthcheck_disable
+[filter:request_id]
+paste.filter_factory = cinder.api.middleware.request_id:RequestId.factory