Comment 16 for bug 1525259

Revision history for this message
Ravi Shekhar Jethani (ravishekar-jethani) wrote : Re: Add request_ids attribute to v2 schemas

Hi All,

The concern raised by Errno [1] has been resolved. Following is the current status:

Case 1: API calls making only a single request to complete operation
This case has no issues so far. The request id generated is simply given to the caller as an
attribute of the returned object. Examples: get(), create() api calls of image api

Case 2: API calls making an arbitrary no. of requests
This is the case for which Errno had raised concern.
A way in which we can solve this is by using same request id for each request
for fetching next page of images and at last returning only one request id as this is the
only request id used for all requests. For example if we have 1000 images and page_size is 10
then there will be 100 requests and we will see 100 entries in log. But the value of
request id will be same in all cases. This single request id will be returned to caller.

Case 3: API calls making a fixed no. of requests to complete operation
This case has an issue that the caller can only get request id of only the last
request. For example update() call in image api [2]. Here the user will only get
the request id of the request made as a part of 'self.get(image_id)' call.
The request id of the first get() call or the http_client.patch() will not
be available to the caller. IMO this is OK because if the 'patch' request fails
the corresponding request will be available as part of the exception logged.

I can see two alternatives here:

a. Return request id of the intermediate patch() instead of the last get().

b. One other solution possible here is that all the requests use the
same request id as in Case 2 above.

For a. and b. solutions we need to add '**kwargs' to get() so that we can pass request id
from a previous request to the current get() call.

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

[2] https://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/images.py#L251

Kindly make suggestions.