Expose 'get_x_openstack_request_id' method in all OpenStack clients api bindings

Registered by Abhishek Kekane

All Openstack API bindings mainly python is being used by many OpenStack core Services or any other third party applications. Each of the OpenStack Restful API returns X-Openstack-Request-Id in the API response but this request id is not available to the caller from the client. If you run command with —debug option, then only client displays the X-Openstack-Request-Id on the console. If there is any issue with the OS API and user wants to report this issue to the service provider, X-Openstack-Request-Id will come handy.

We are proposing to add get_x_openstack_request_id method in all OpenStack python API bindings.

Design:
When a caller make a call and get a response from the OpenStack service, it will extract
X-Openstack-Request-Id from the response header and store it in the thread local storage. Add a new method ‘get_x_openstack_request_id’ in the client to return X-Openstack-Request-Id stored in the thread local storage to the caller. We need to store request id in the TLS because same client object could be used in multithread application to interact with the OpenStack services.

Example
from cinderclient import client

cinder = client.Client('2', 'demo', 'admin', 'demo', 'http://21.12.4.342:5000/v2.0')

cinder.volumes.list()
[<Volume: 88c77848-ef8e-4d0a-9bbe-61ac41de0f0e>, <Volume: 4b731517-2f3d-4c93-a580-77665585f8ca>]

cinder.get_openstack_request_id()
'req-a9b74258-0b21-49c2-8ce8-673b420e20cc'

We will make changes to the following python api bindings:
1. python-cinderclient
2. python-novaclient
3. python-glanceclient
4. python-heatclient
5. python-neutronclient

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Abhishek Kekane
Direction:
Needs approval
Assignee:
Abhishek Kekane
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Abhishek Kekane

Related branches

Sprints

Whiteboard

As per discussion with OpenStack SDK team, these changes needs to be done in individual python clients.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.