Return request Id to caller

Registered by Abhishek Kekane

Most of the OpenStack RESTful API returns X-Openstack-Request-Id in the API response header but this request id is not available to the caller from the python client. When you run command on the command prompt using client with --debug option, then it displays X-Openstack-Request-Id on the console but if you are using it in some third party applications and if some api fails or succeeds then there is no way to get X-Openstack-Request-Id from the returned value. If request id is made to the caller, then it would definitely help in getting quick support from infrastructure support team in case of any problems.

We are proposing to add 'request_ids' as attribute to the response objects returned from python-cinderclient.

For more details on how request_id will be returned to the caller, please refer to the approved blueprint [1] discussed with the cross-project team.

[1] : https://review.openstack.org/#/c/156508

For example:

from cinderclient import client

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

# Get request id from vols resource object

vols['request_ids']

'req-1784a36c-5aaf-4042-9ede-5076b67f2354'

Blueprint information

Status:
Complete
Approver:
Sean McGinnis
Priority:
Undefined
Drafter:
Abhishek Kekane
Direction:
Needs approval
Assignee:
Ankit Agrawal
Definition:
Approved
Series goal:
Accepted for mitaka
Implementation:
Implemented
Milestone target:
None
Started by
Abhishek Kekane
Completed by
Abhishek Kekane

Related branches

Sprints

Whiteboard

We are planning to break changes in smaller patches as below:

patch 1: containing common changes in cinderclient/base.py and cinderclient/openstack/common/apiclient changes for adding wrapper classes around response

patch 2: changes in volume, volume_snapshot, volume_types and volume_types_access

patch 3: changes in volume_backups, volume_backups_restore, volume_encryption_types and volume_transfers

patch 4: changes in qos_specs, consistencygroup, cgsnapshots, services, quotas, quota_classes

Gerrit topic: https://review.openstack.org/#q,topic:bp/return-request-id-to-caller,n,z

Addressed by: https://review.openstack.org/257170
    Add Wrapper classes for list, dict, tuple

Addressed by: https://review.openstack.org/257180
    Return wrapper classes with request_ids attribute

Addressed by: https://review.openstack.org/257187
    Add request_ids attribute to resource objects

Addressed by: https://review.openstack.org/257195
    Add request_ids attribute to resource objects

Addressed by: https://review.openstack.org/257199
    Add request_ids attribute to resource objects

Addressed by: https://review.openstack.org/273930
    Add release notes for return-request-id-to-caller

Addressed by: https://review.openstack.org/280558
    Provide consistency for Wrapper classes

(?)

Work Items

Work items:
Add a wrapper class around response: DONE
Modify v2 api to return request-id: DONE
Unit test cases: DONE

This blueprint contains Public information 
Everyone can see this information.