--os-image-api-version 2 behaviour inconsistent

Bug #1489386 reported by Stuart McLaren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Medium
Flavio Percoco

Bug Description

If only v1 is available and the schema has been cached, then this command will produce:

$ glance --os-tenant-name=blah --os-username=blah --os-auth-url=blah --os-region region-a.geo-1 --os-image-api-version 2 image-show d6bc96f0-70da-432b-a27c-dcf99d61ef0d
HTTPMultipleChoices (HTTP 300) Requested version of OpenStack Images API is not available.

If the schema is not cached, the behaviour is:

$ glance --os-tenant-name=blah --os-username=blah --os-auth-url=blah --os-region region-a.geo-1 --os-image-api-version 2 image-show d6bc96f0-70da-432b-a27c-dcf99d61ef0d
WARNING: The client is falling back to v1 because the accessing to v2 failed. This behavior will be removed in future versions
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | a16a81de3d944ebee63810f36b826a63 |
| container_format | bare |
| created_at | 2014-07-31T12:48:53 |
| deleted | False |
| disk_format | raw |
| id | d6bc96f0-70da-432b-a27c-dcf99d61ef0d |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | x |
| owner | 61624292678963 |
| protected | False |
| size | 1048576000 |
| status | active |
| updated_at | 2014-07-31T12:49:47 |
+------------------+--------------------------------------+

If the user explicitly selects the API version on the command line (--os-image-api-version 2) the appropriate behaviour is to return "HTTPMultipleChoices (HTTP 300) Requested version of OpenStack Images API is not available." in all cases where it is not available.

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Overall, I think the behaviour should be:

glance --os-image-api-version 1 ... -> fail if version 1 is not available
glance --os-image-api-version 2 ... -> fail if version 2 is not available
glance ... -> The user has expressed no preference. Query the endpoint to see if v2 is available -- if so, use it. If not, is v1 available? If so, use it.

It's important that if a user explicitly selects an api version that we fail if that version is not available.

For example an operator may have monitoring scripts such as:

script 1:
# ensure v1 is responsive
glance --os-image-api-version 1 ...

script 2:
#ensure v2 is responsive
glance --os-image-api-version 2 ...

if 'script 2' works by falling back to v1 in this case there's no way for the operator to use the client cli to verify v2 is alive.

tags: added: 1.0.0-potential
Revision history for this message
Flavio Percoco (flaper87) wrote :

Stuart, I believe these 2 patches[0][1] fix this issue as well. Could you help me verifying it?

If so, I'll add the bug number to the first patch. This is also tested in that one.

[0] https://review.openstack.org/#/c/219469/
[1] https://review.openstack.org/#/c/219686/

Changed in python-glanceclient:
assignee: nobody → Flavio Percoco (flaper87)
importance: Undecided → Medium
status: New → Triaged
Changed in python-glanceclient:
status: Triaged → Fix Committed
Changed in python-glanceclient:
milestone: none → 1.1.0
status: Fix Committed → Fix Released
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.