cinder list does weird things if pointed at a v1 endpoint with OS_VOLUME_API_VERSION=2

Bug #1169455 reported by stephen mulcahy
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-cinderclient
Fix Released
Undecided
Anastasia Latynskaya

Bug Description

ubuntu@devstack:~$ . ~/devstack/openrc
ubuntu@devstack:~$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 50b24c25-4d1d-4b92-aa0f-d743e0c0ed80 | available | foo | 1 | None | false | |
| d8a9e6c5-7cda-488f-a662-45c8970adfcc | available | None | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
ubuntu@devstack:~$ export OS_VOLUME_API_VERSION=2
ubuntu@devstack:~$ cinder list
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| 50b24c25-4d1d-4b92-aa0f-d743e0c0ed80 | available | | 1 | None | false | |
| d8a9e6c5-7cda-488f-a662-45c8970adfcc | available | | 1 | None | false | |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+

Note that when using the v2 api, we use "Name" instead of "Display Name" but the field in the volumes table in the db is display_name so it needs to be translated during display.

Revision history for this message
Cristian Tomoiaga (ctomoiaga) wrote :

Not sure if this is by design or not, but changing the api version on the client side does not call the actual v2 api on the server side hence the issue you see here. Calls are made to v1 even if you set v2 in cinder client. (see endpoints)

Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

Good catch - you are right. Not sure what the server-side behaviour should be in this case but the fix is not applicable

Revision history for this message
Cristian Tomoiaga (ctomoiaga) wrote :

This can be fixed in either cinderclient/base.py in Manager (probably not the best location since this only seems to list from the database) or if it's just display related in do_list at v2/shell.py by setattr if vol.display_name is not none before printing for example.
I'm not familiar enough with the whole process of submitting patches yet.

Rushi Agrawal (rushiagr)
Changed in cinder:
status: New → Confirmed
Revision history for this message
Mike Perez (thingee) wrote :

I'm pretty sure the reason why you're hitting this problem is because your keystone endpoint is still going to v1.

Revision history for this message
Cristian Tomoiaga (ctomoiaga) wrote :

Indeed, it goes to v1 as pointed above.
As an additional question related to the design of OpenSpack, does a v2 client supposed to work with a v1 api ?
There already is code for compatibility between a v2 server and a v1 client in the code (see shell.py in do_list).

Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

So this is a non-issue then, and a user should only

export OS_VOLUME_API_VERSION=2

if their service catalog uses the v2 api?

If thats the case, feel free to close

Revision history for this message
Mike Perez (thingee) wrote : Re: cinder list fails to display volume name if using v2 of api

Cristian, yes the client will continue to support v1 until it's removed from cinder.

Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

Marked as Invalid given the comments above

Changed in cinder:
status: Confirmed → Invalid
summary: - cinder list fails to display volume name if using v2 of api
+ cinder list does weird things if pointed at a v1 endpoint with
+ OS_VOLUME_API_VERSION=2
Changed in cinder:
status: Invalid → New
Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

so should the cinder client throw a user friendly error if OS_VOLUME_API_VERSION=x and there isn't a Vx available?

Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

Or should we move away from using OS_VOLUME_API_VERSION and use only what the service catalog reports as the endpoint?

Changed in python-cinderclient:
status: New → In Progress
assignee: nobody → Anastasia Latynskaya (alatynskaya)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (master)

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

Revision history for this message
Anastasia Latynskaya (alatynskaya) wrote :

Should we raise exception if the versions are not similar or should be only warning shown?

Revision history for this message
stephen mulcahy (stephen-mulcahy) wrote :

I think running any cinderclient command against a cinder endpoint where the endpoint version is different from OS_VOLUME_API_VERSION should result in an error like

ERROR: env[OS_VOLUME_API_VERSION] is set to 2 but you are accessing a v1 endpoint

or similar

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/31790
Committed: http://github.com/openstack/python-cinderclient/commit/6adda93c9d52a1bb841261725f666a439b54539c
Submitter: Jenkins
Branch: master

commit 6adda93c9d52a1bb841261725f666a439b54539c
Author: Anastasia Latynskaya <email address hidden>
Date: Mon Jun 10 13:08:29 2013 +0400

    Connectivity between the endpoint version and OS_VOLUME_API_VERSION.

    Adds functionality which allows user to work with
    that cinder API version which is the same as
    the endpoint version.

    Fixes: bug #1169455

    Change-Id: I9bb46e602d15856d2da502a6ac2b6c25e76f4fa3

Changed in python-cinderclient:
status: In Progress → Fix Committed
Mike Perez (thingee)
no longer affects: cinder
Changed in python-cinderclient:
milestone: none → 1.3.1
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.