Bug 1288654

Summary: Horizon - Launch an instance on admin project return Internal Server Error
Product: Red Hat OpenStack Reporter: Eric Harney <eharney>
Component: python-django-horizonAssignee: Matthias Runge <mrunge>
Status: CLOSED ERRATA QA Contact: Ido Ovadia <iovadia>
Severity: urgent Docs Contact:
Priority: high    
Version: 6.0 (Juno)CC: aortega, athomas, brault, eharney, geguileo, iovadia, jmelvin, jraju, mcornea, mrunge, mschuppe, nlevinki, srevivo
Target Milestone: asyncKeywords: Regression, Triaged, ZStream
Target Release: 6.0 (Juno)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-django-horizon-2014.2.3-8.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1288652 Environment:
Last Closed: 2016-06-08 12:19:06 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:
Embargoed:
Bug Depends On: 1287621, 1288652    
Bug Blocks: 743661    

Description Eric Harney 2015-12-04 21:39:38 UTC
+++ This bug was initially created as a clone of Bug #1288652 +++

+++ This bug was initially created as a clone of Bug #1287621 +++

Description of problem:
=======================
Launch an instance (on horizon) on admin project return Internal Server Error


2015-12-02 12:20:52,972 3930 ERROR django.request Internal Server Error: /dashboard/project/instances/launch
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 52, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 84, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/workflows/views.py", line 167, in post
    context = self.get_context_data(**kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/workflows/views.py", line 91, in get_context_data
    workflow = self.get_workflow()
  File "/usr/lib/python2.7/site-packages/horizon/workflows/views.py", line 81, in get_workflow
    entry_point=entry_point)
  File "/usr/lib/python2.7/site-packages/horizon/workflows/base.py", line 648, in __init__
    valid = step.action.is_valid()
  File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 184, in is_valid
    return self.is_bound and not self.errors
  File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 176, in errors
    self.full_clean()
  File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 393, in full_clean
    self._clean_form()
  File "/usr/lib/python2.7/site-packages/django/forms/forms.py", line 417, in _clean_form
    cleaned_data = self.clean()
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 357, in clean
    self._check_quotas(cleaned_data)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 209, in _check_quotas
    usages = quotas.tenant_quota_usages(self.request)
  File "/usr/lib/python2.7/site-packages/horizon/utils/memoized.py", line 90, in wrapped
    value = cache[key] = func(*args, **kwargs)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/quotas.py", line 361, in tenant_quota_usages
    _get_tenant_volume_usages(request, usages, disabled_quotas, tenant_id)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/usage/quotas.py", line 332, in _get_tenant_volume_usages
    snapshots = cinder.volume_snapshot_list(request, opts)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/api/cinder.py", line 302, in volume_snapshot_list
    search_opts=search_opts)]
  File "/usr/lib/python2.7/site-packages/cinderclient/v2/volume_snapshots.py", line 131, in list
    "snapshots")
  File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 65, in _list
    resp, body = self.api.client.get(url)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 326, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 289, in _cs_request
    **kwargs)
  File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 272, in request
    raise exceptions.from_response(resp, body)
ClientException: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-cb7c6533-65f0-4905-8c72-2f8aef8e5b46)



Version-Release number of selected component:
============================================
python-django-horizon-2015.1.2-3.el7ost.noarch


How reproducible:
================
100%


Steps to Reproduce:
===================
1. Deploy RHOS 7.2 (z3)
2. Connect to Horizon as admin 
3. Create an instance

Actual results:
===============
An error appears 

Danger: There was an error submitting the form. Please try again


Expected results:
=================
instance created successfully

--- Additional comment from Matthias Runge on 2015-12-02 10:13:21 EST ---

Cinder logs are showing:
2015-12-01 10:49:40.238 12951 ERROR cinder.api.middleware.fault [req-48f9277d-0ea8-4af9-b80c-a3e9eacdca6c
 00074bde5412442499a7390d98c824d9 0788735cc9a445ac95611db9dffafebb - - -] Caught error: Entity '<class 'c
inder.db.sqlalchemy.models.Snapshot'>' has no property 'tenant_id'
2015-12-01 10:49:40.239 12951 INFO cinder.api.middleware.fault [req-48f9277d-0ea8-4af9-b80c-a3e9eacdca6c 00074bde5412442499a7390d98c824d9 0788735cc9a445ac95611db9dffafebb - - -] http://cougar11.scl.lab.tlv.redhat.com:8776/v2/0788735cc9a445ac95611db9dffafebb/snapshots/detail?alltenants=1&tenant_id=0788735cc9a445ac95611db9dffafebb returned with HTTP 500
2015-12-01 10:49:40.240 12951 INFO eventlet.wsgi.server [req-48f9277d-0ea8-4af9-b80c-a3e9eacdca6c 00074bde5412442499a7390d98c824d9 0788735cc9a445ac95611db9dffafebb - - -] 10.35.160.111 - - [01/Dec/2015 10:49:40] "GET /v2/0788735cc9a445ac95611db9dffafebb/snapshots/detail?alltenants=1&tenant_id=0788735cc9a445ac95611db9dffafebb HTTP/1.1" 500 425 0.007403


Which makes me think, this is a cinder issue.

--- Additional comment from Gorka Eguileor on 2015-12-04 04:06:06 EST ---

Root of the problem is an horizon bug (even though Cinder should not return 500): https://bugs.launchpad.net/horizon/+bug/1469589

And it gets fixed in here: https://github.com/openstack/horizon/commit/faa44bfe1d6c4f342b8572bc4939771cda2039c7

As for Cinder, it should not return 500, so we need to we need to add filter validation (https://github.com/openstack/cinder/commit/8ba66fc5d2672bff69c21e36918e5e1882167649).  Some of the validations introduced in this patch are already in place, though some are missing on 7.0.

We need Horizon fix as well as the Cinder fix, because with only the Cinder fix Horizon will receive an empty list due to the malformed request.


--- Additional comment from Matthias Runge on 2015-12-04 08:35:02 EST ---

Horizon backport is here https://review.openstack.org/253496

Comment 1 Matthias Runge 2015-12-07 10:25:38 UTC
This is not a regression, as Horizon did not broke something here due to backports.

I agree, if cinder had a stack trace, but tolerated it, we should fix this in horizon. But in current juno version, this just works.

Comment 2 Matthias Runge 2015-12-08 12:54:38 UTC
The diff for a mini-patch should be something like this:
diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py
index c51aed0..c060ebb 100644
--- a/openstack_dashboard/usage/quotas.py
+++ b/openstack_dashboard/usage/quotas.py
@@ -257,7 +257,7 @@ def tenant_quota_usages(request, tenant_id=None):
 
     if 'volumes' not in disabled_quotas:
         if tenant_id:
-            opts = {'alltenants': 1, 'tenant_id': tenant_id}
+            opts = {'all_tenants': 1, 'project_id': tenant_id}
             volumes = cinder.volume_list(request, opts)
             snapshots = cinder.volume_snapshot_list(request, opts)
         else:

Unfortunately, the tests don't apply cleanly any more, code has been refactored since juno.

Comment 5 Matthias Runge 2016-03-04 09:22:24 UTC
*** Bug 1302834 has been marked as a duplicate of this bug. ***

Comment 10 Ido Ovadia 2016-06-07 15:16:06 UTC
Verified
========
python-django-horizon-2014.2.3-8.el7ost.noarch

Comment 12 errata-xmlrpc 2016-06-08 12:19:06 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.

https://access.redhat.com/errata/RHBA-2016:1215