VersionNotFoundForAPIMethod message is not working when using microversion

Bug #1568795 reported by wanghao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Invalid
Low
wanghao

Bug Description

Now when use microversion and specify the OpenStack-API-Version as string "3.0", Cinder will return HTTP 400, error message is "The server could not comply with the request since it is either malformed or otherwise incorrect.".

But look into the code, Cinder should want to raise VersionNotFoundForAPIMethod with message "API version %(version)s is not supported on this method.".

So there is needed some changes to make the message more clear.

wanghao (wanghao749)
Changed in cinder:
assignee: nobody → wanghao (wanghao749)
milestone: none → newton-1
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/304027

Changed in cinder:
status: New → In Progress
Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

Hi wanghao. How are you reproducing this? It seems like your fix might be needed, but I don't see the result when I use curl, and the client does not yet have support for microversions.
This seems to work for me:
scott@ubuntuDevApr1:~/devstack$ curl -g -i -X GET http://192.168.122.175:8776/v3/d44d9d21f8024d3ba2f69e92ea9bc2f5/volumes/detail -Hython-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: 5f76ff3ab5ac400c95ba866e9fdb1290" -H "OpenStack-API-Version: volume 3.0"
HTTP/1.1 200 OK
X-Compute-Request-Id: req-0d842053-dca8-4a7e-aeef-3612b28d5e30
Content-Type: application/json
Content-Length: 15
Openstack-Api-Version: volume 3.0
Vary: OpenStack-API-Version
X-Openstack-Request-Id: req-0d842053-dca8-4a7e-aeef-3612b28d5e30
Date: Mon, 11 Apr 2016 12:45:46 GMT

{"volumes": []}

Revision history for this message
wanghao (wanghao749) wrote :

Hi, Scott. I use this :

curl -g -i -X GET http://10.229.40.105:8776/v3/62ef98b2e02d4e56963c8ccb225da800/volumes/detail -H "Accept: application/json" -H "X-Auth-Token: aba5e0922a604265ba28e9a6c2a6c626" -H "OpenStack-API-Version: 3.0"
HTTP/1.1 400 Bad Request
Content-Length: 141
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-9f19d4f0-f44d-46e6-9823-fd481582a07e
X-Openstack-Request-Id: req-9f19d4f0-f44d-46e6-9823-fd481582a07e
Date: Thu, 14 Apr 2016 03:32:30 GMT

{"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}

The point is I put "3.0" not "volume 3.0" in the Header "OpenStack-API-Version".

Revision history for this message
Scott DAngelo (scott-dangelo) wrote :

OK, the problem is that, according to standards set by the API working group, all services (Cinder, Nova, Manila, Ironic today, others in the future) will use the same http header:
"OpenStack-API-Version:"
so thing could look like this:
"OpenStack-API-Version: volume 3.0, compute 2.21, shares 2.14"
If you only specify the header, with no service, in the manner that you have done to reproduce this:
"OpenStack-API-Version: 3.0"
I don't think it should return an exception that is specific to Cinder/volume. That would imply that this header is for volume, when in fact it is generic for all OpenStack services.
So, I think that for the case you have found, it is best to continue with the HTTP 400 for 'malformed or otherwise incorrect'.

Changed in cinder:
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by wanghao (<email address hidden>) on branch: master
Review: https://review.openstack.org/304027
Reason: Returning 400 is a proper response for this case, so abandon this patch.

Changed in cinder:
milestone: newton-1 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.