OpenStack Dashboard (Horizon)

KeyError: 'instance' raised when attaching a volume to an instance

Reported by Vincent Hou on 2012-05-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
Tihomir Trifonov

Bug Description

I have got the following error, when I was attaching a volume to an instance.

[Tue May 15 15:10:18 2012] [error]
[Tue May 15 15:10:18 2012] [error] CRITICAL:openstack_dashboard:Unhandled Exception in of type "<type 'exceptions.KeyError'>" in dashboard.
[Tue May 15 15:10:18 2012] [error] Traceback (most recent call last):
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
[Tue May 15 15:10:18 2012] [error] response = callback(request, *callback_args, **callback_kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 40, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 55, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 40, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 48, in view
[Tue May 15 15:10:18 2012] [error] return self.dispatch(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in dispatch
[Tue May 15 15:10:18 2012] [error] return handler(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py", line 105, in get
[Tue May 15 15:10:18 2012] [error] handled = self.construct_tables()
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py", line 91, in construct_t
ables
[Tue May 15 15:10:18 2012] [error] preempted = table.maybe_preempt()
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 960, in maybe_preem
pt
[Tue May 15 15:10:18 2012] [error] error = exceptions.handle(request, ignore=True)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 956, in maybe_preem
pt
[Tue May 15 15:10:18 2012] [error] new_row.load_cells(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 351, in load_cells
[Tue May 15 15:10:18 2012] [error] data = column.get_data(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 215, in get_data
[Tue May 15 15:10:18 2012] [error] data = self.transform(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/dashboards/nova/instances_and_volumes/vol
umes/tables.py", line 96, in get_attachment
[Tue May 15 15:10:18 2012] [error] "name": attachment["instance"].name,
[Tue May 15 15:10:18 2012] [error] KeyError: 'instance'
[Tue May 15 15:10:18 2012] [error] ERROR:django.request:Internal Server Error: /nova/instances_and_volumes/
[Tue May 15 15:10:18 2012] [error] Traceback (most recent call last):
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
[Tue May 15 15:10:18 2012] [error] response = callback(request, *callback_args, **callback_kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 40, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 55, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py", line 40, in dec
[Tue May 15 15:10:18 2012] [error] return view_func(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 48, in view
[Tue May 15 15:10:18 2012] [error] return self.dispatch(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in dispatch
[Tue May 15 15:10:18 2012] [error] return handler(request, *args, **kwargs)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py", line 105, in get
[Tue May 15 15:10:18 2012] [error] handled = self.construct_tables()
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py", line 91, in construct_t
ables
[Tue May 15 15:10:18 2012] [error] preempted = table.maybe_preempt()
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 960, in maybe_preem
pt
[Tue May 15 15:10:18 2012] [error] error = exceptions.handle(request, ignore=True)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 956, in maybe_preem
pt
[Tue May 15 15:10:18 2012] [error] new_row.load_cells(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 351, in load_cells
[Tue May 15 15:10:18 2012] [error] data = column.get_data(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 215, in get_data
[Tue May 15 15:10:18 2012] [error] data = self.transform(datum)
[Tue May 15 15:10:18 2012] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/dashboards/nova/instances_and_volumes/vol
umes/tables.py", line 96, in get_attachment
[Tue May 15 15:10:18 2012] [error] "name": attachment["instance"].name,
[Tue May 15 15:10:18 2012] [error] KeyError: 'instance'
2] [error] DEBUG:django.db.backends:(0.001) SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_d
ate" FROM "django_session" WHERE ("django_session"."session_key" = 81ef07c50a431254f22eae9b12e33b22 AND "django_session"."expire_date" > 2012
-05-15 15:10:58.839426 ); args=('81ef07c50a431254f22eae9b12e33b22', u'2012-05-15 15:10:58.839426')
[Tue May 15 15:10:58 2012] [error] DEBUG:horizon.api.glance:glanceclient connection created using token "858b6fd783da43a99755d14b3a817ace" and
 url "http://9.119.148.201:9292"
[Tue May 15 15:10:58 2012] [error] DEBUG:glanceclient.common.http:REQ: curl -i http://9.119.148.201:9292/v1/images/detail -X GET -H "User-Agen
t: python-glanceclient" -H "X-Auth-Token: 858b6fd783da43a99755d14b3a817ace"
[Tue May 15 15:10:58 2012] [error]

Finally the volume can be attached to this instance, but the error needs someone to take a look.

Vincent Hou (houshengbo) on 2012-05-15
summary: - Errors raised when attaching a volume to an instance
+ KeyError: 'instance' raised when attaching a volume to an instance
Gabriel Hurley (gabriel-hurley) wrote :

The relevant line is here: https://github.com/openstack/horizon/blob/master/horizon/dashboards/nova/instances_and_volumes/volumes/tables.py#L96

If you're getting that error there's something strange about the data being returned by nova volume (e.g. it finds an attachment but that attachment doesn't have an "instance" key as it should), however we could code that more defensively and have it fail more elegantly.

Changed in horizon:
importance: Undecided → Low
milestone: none → folsom-2
status: New → Confirmed
Devin Carlen (devcamcar) on 2012-05-30
Changed in horizon:
importance: Low → Medium
Changed in horizon:
assignee: nobody → Tihomir Trifonov (ttrifonov)

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

Changed in horizon:
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/8184
Committed: http://github.com/openstack/horizon/commit/58762cda5a7b0b11058b15bfd41108ddcfdc3c34
Submitter: Jenkins
Branch: master

commit 58762cda5a7b0b11058b15bfd41108ddcfdc3c34
Author: Tihomir Trifonov <email address hidden>
Date: Tue Jun 5 18:11:01 2012 +0300

    Added a check for attachment['instance']

    The problem, described in the ticket occurs
    while you try to attach a volume to instance,
    while at the same time terminating the instance(
    I've succeeded to reproduce it that way).
    As seen from the stack trace - the error comes
    after an AJAX call for updating the table rows.
    In normal situations with loading the page,
    this error should not appear. Anyway, now there
    is a check to prevent this error.

    Fixes bug 999502

    Change-Id: Ifccc2cf724fe14098c74b55e65f8fbdd8c5434dc

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-07-04
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-09-27
Changed in horizon:
milestone: folsom-2 → 2012.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers