Bug 1035790

Summary: [RFE] Support for Cinder v2
Product: Red Hat OpenStack Reporter: Dafna Ron <dron>
Component: python-django-horizonAssignee: Julie Pichon <jpichon>
Status: CLOSED ERRATA QA Contact: Amit Ugol <augol>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: aberezin, aortega, athomas, augol, dnavale, iovadia, jpichon, mrunge, rhos-integ, slong, yeylon
Target Milestone: Upstream M3Keywords: FutureFeature, Triaged
Target Release: 5.0 (RHEL 7)   
Hardware: x86_64   
OS: Linux   
URL: https://blueprints.launchpad.net/horizon/+spec/cinder-v2-horizon
Whiteboard: storage upstream_milestone_icehouse-3 upstream_status_implemented upstream_definition_approved
Fixed In Version: python-django-horizon-2014.1-4.el7ost Doc Type: Enhancement
Doc Text:
If the Block Storage service endpoint was set to Cinder v2, Dashboard displayed a 500 error when trying to display volume-related pages. With this update, Cinder v2 is supported and the OPENSTACK_API_VERSIONS dictionary in the local_settings file can now take a 'volume' attribute that can be set to either 1 or 2, depending on the Block Storage version the administrator wants to use.
Story Points: ---
Clone Of:
: 1081703 (view as bug list) Environment:
Last Closed: 2014-07-08 15:43:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1081703    
Attachments:
Description Flags
log none

Description Dafna Ron 2013-11-28 13:40:15 UTC
Created attachment 830242 [details]
log

Description of problem:

cinder endpoint v2 changed the volume names attr to --name instead of --display-name.

when I change the cinder endpoint to v2 and create volumes, horizon crashes when we try to query the volumes

Version-Release number of selected component (if applicable):

python-django-horizon-2013.2-5.el6ost.noarch

How reproducible:

100%

Steps to Reproduce:
Run the following in cli:

1. install openstack with packstack
2. change cinder's endpoint in keystone to v2:

keystone endpoint-create --region RegionOne --service-id 10fd33fdca4f4ca4a2e21c2c786a3495 --publicurl 'http://<ip>:8776/v2/%(tenant_id)s' --adminurl 'http://<ip>:8776/v2/%(tenant_id)s' --internalurl 'http://<ip>:8776/v2/%(tenant_id)s'

delete the old v1 endpoint:

keystone endpoint-delete <endpoint that uses v1>

3. create a volume using v2 API:

OS_VOLUME_API_VERSION=2 cinder create 10 --name <name>

4. log in to horizon -> project -> volumes

Actual results:

Horizon gives an attr error on name

Expected results:

we should be able to query both v1 and v2 attr. 
but if not we need a clear error and not an attr error. 

Additional info:

2013-11-28 13:26:10,862 24349 ERROR django.request Internal Server Error: /dashboard/project/volumes/
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.6/site-packages/horizon/decorators.py", line 38, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/horizon/decorators.py", line 54, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/horizon/decorators.py", line 38, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/horizon/decorators.py", line 86, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/django/views/generic/base.py", line 48, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/django/views/generic/base.py", line 69, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/horizon/tables/views.py", line 155, in get
    handled = self.construct_tables()
  File "/usr/lib/python2.6/site-packages/horizon/tables/views.py", line 146, in construct_tables
    handled = self.handle_table(table)
  File "/usr/lib/python2.6/site-packages/horizon/tables/views.py", line 118, in handle_table
    data = self._get_data_dict()
  File "/usr/lib/python2.6/site-packages/horizon/tables/views.py", line 182, in _get_data_dict
    self._data = {self.table_class._meta.name: self.get_data()}
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/volumes/views.py", line 85, in get_data
    self._set_id_if_nameless(volumes, instances)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/volumes/views.py", line 67, in _set_id_if_nameless
    if not volume.display_name:
  File "/usr/lib/python2.6/site-packages/cinderclient/base.py", line 268, in __getattr__
    raise AttributeError(k)
AttributeError: display_name

Comment 1 Julie Pichon 2013-11-28 13:49:28 UTC
Horizon does not support the Cinder v2 API in Havana, cf. upstream bug.

Comment 2 Julie Pichon 2014-02-12 10:20:39 UTC
How to test (copied from blueprint's whiteboard in case it gets lost):

In the local settings, set 'volume' in OPENSTACK_API_VERSIONS to 1 or 2 depending on the version you want to test.

OPENSTACK_API_VERSIONS = {
    "volume": 2
}

If your debug levels are set, you should be able to verify that the cinderclient calls are using the appropriate v1 or v2 URL.

Panels of interests:
* Volumes: All the volume actions should still work using either v1 or v2
* Images & Snapshots: Volume snapshots actions should work using v1 and v2
* Instances: Create instance has several options related to volumes and booting from volumes, these should still work and the volumes or volume snapshots displayed correct
* Admin - Volumes: Should display correctly, no changes for volume types which are still expected to work with both versions.

The name display was also generally improved so that the volume id is always shown if the volume doesn't have a name.

Comment 3 Julie Pichon 2014-02-12 10:21:43 UTC
*** Bug 1059471 has been marked as a duplicate of this bug. ***

Comment 4 Julie Pichon 2014-02-20 09:05:52 UTC
Fixing up the blueprint URL (oops)

Comment 5 Julie Pichon 2014-05-27 09:45:58 UTC
This was merged during upstream Icehouse and should already be available in our packages.

Comment 6 Amit Ugol 2014-06-08 05:47:15 UTC
Note that this bug is marked for RHEL 7.0 which uses a different python altogether.
I have have changed the settings:
OPENSTACK_API_VERSIONS = {
    "volume": 2
}
restarted the services, and created a new volume.
See attached cinder logs, it seems fine to me.
Horizon is working properly, nothing unusual in the horizon.log

tested on python-django-horizon-2014.1-7.el7ost.noarch

Comment 8 errata-xmlrpc 2014-07-08 15:43:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0855.html