[glance] Global Request ID issues in Glance

Markus Hentsch markus.hentsch at secustack.com
Fri Jun 26 12:54:02 UTC 2020

Hello everyone,

while I was experimenting with the Global Request ID functionality of
OpenStack [1], I identified two issues in Glance related to this topic.
I have written my findings below and would appreciate it if you could
take a look and confirm whether those are intended behaviors or indeed
issues with the implementation.

In case of the latter please advice me which bug tracker to report them

1. The Glance client does not correctly forward the global ID

When the SessionClient class is used, the global_request_id is removed
from kwargs in the constructor using pop() [2]. Directly after this,
the parent constructor is called using super(), which in this case is
Adapter from the keystoneauth1 library. Therein the global_request_id
is set again [3] but since it has been removed from the kwargs, it
defaults to None as specified in the Adapter's __init__() header. Thus,
the global_request_id passed to the SessionClient constructor never
actually makes it to the Glance API. This is in contrast to the
HTTPClient class, where get() is used instead of pop() [4].

This can be reproduced simply by creating a server in Nova from an
image in Glance, which will attempt to create the Glance client
instance using the global_request_id [5]. Passing the
"X-Openstack-Request-Id" header during the initial API call for the
server creation, makes it visible in Nova (using a suitable
"logging_context_format_string" setting) but it's not visible in
Glance. Using a Python debugger shows Glance generating a new local ID

2. Glance interprets global ID as local one for Oslo Context objects

While observing the Glance log file, I observed Glance always logging
the global_request_id instead of a local one if it is available.

Using "%(global_request_id)s" within "logging_context_format_string"[6]
in the glance-api.conf will always print "None" in the logs whereas
"%(request_id)s" will either be an ID generated by Glance if no global
ID is available or the received global ID.

Culprit seems to be the context middleware of Glance where the global
ID in form of the "X-Openstack-Request-Id" header is parsed from the
request and passed as "request_id" instead of "global_request_id" to
the "glance.context.RequestContext.from_environ()" call [7].

This is in contrast to other services such as Nova or Neutron where
the two variables actually print the values according to their name
(request_id always being the local one, whereas global_request_id is
the global one or None).




Markus Hentsch
Team Leader

secustack GmbH - Digital Sovereignty in the Cloud
Königsbrücker Straße 96 (Gebäude 30) | 01099 Dresden
District Court Dresden, Register Number: HRB 38890

More information about the openstack-discuss mailing list