Horizon crashed when parsing volume list including a volume without name

Bug #1389108 reported by Trung Trinh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Trung Trinh
Juno
Fix Released
Low
Kieran Spear

Bug Description

This bug can be re-produced as follows:
 - 1. Use Nova or Cinder CLI to create a volume without name that can be used to boot a new VM:

nova boot some_name --flavor 1 --image some_img_id --nic net-id=some_nic_id --block-device source=image,id=some_img_id,dest=volume,size=1,bootindex=1"

       Note that: in the "--block-device", we don't specify volume name

cinder create 1 --image-id some_img_id

       Note that: we don't specify name for the volume to be created

 - 2. After that, if we try to retrieve the volume list by clicking the tab "Volumes" on Horizon, then Horizon will always be crashed. Note that, the crash does not occur when using CLI "cinder list" to list all available volumes.

Traceback:

[Tue Nov 04 06:36:51.620653 2014] [:error] [pid 12412:tid 140421861299968] Error while rendering table rows.

[Tue Nov 04 06:36:51.620733 2014] [:error] [pid 12412:tid 140421861299968] Traceback (most recent call last):

[Tue Nov 04 06:36:51.620776 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 1731, in get_rows

[Tue Nov 04 06:36:51.620817 2014] [:error] [pid 12412:tid 140421861299968] row = self._meta.row_class(self, datum)

[Tue Nov 04 06:36:51.620871 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 522, in __init__

[Tue Nov 04 06:36:51.620911 2014] [:error] [pid 12412:tid 140421861299968] self.load_cells()

[Tue Nov 04 06:36:51.620975 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 548, in load_cells

[Tue Nov 04 06:36:51.621040 2014] [:error] [pid 12412:tid 140421861299968] cell = table._meta.cell_class(datum, column, self)

[Tue Nov 04 06:36:51.621078 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 644, in __init__

[Tue Nov 04 06:36:51.621118 2014] [:error] [pid 12412:tid 140421861299968] self.data = self.get_data(datum, column, row)

[Tue Nov 04 06:36:51.621159 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 682, in get_data

[Tue Nov 04 06:36:51.621200 2014] [:error] [pid 12412:tid 140421861299968] data = column.get_data(datum)

[Tue Nov 04 06:36:51.621238 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../horizon/tables/base.py", line 375, in get_data

[Tue Nov 04 06:36:51.621331 2014] [:error] [pid 12412:tid 140421861299968] data = self.get_raw_data(datum)

[Tue Nov 04 06:36:51.621373 2014] [:error] [pid 12412:tid 140421861299968] File "/opt/stack_stable_juno/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/project/volumes/volumes/tables.py", line 298, in get_raw_data

[Tue Nov 04 06:36:51.621414 2014] [:error] [pid 12412:tid 140421861299968] "dev": html.escape(attachment["device"])}

[Tue Nov 04 06:36:51.621473 2014] [:error] [pid 12412:tid 140421861299968] KeyError: 'device'

Root cause: from the above Traceback, it's easy to see that the crash root cause is because Horizon tries to get the value of a non-existing key.

Proposal for fixing this bug: secure the accessing the key "device" as follows:
       "dev": html.escape(attachment.get("device", ""))}

Changed in horizon:
assignee: nobody → Trung Trinh (trung-t-trinh)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
status: New → In Progress
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/132644
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=af23dd8faeefedcb9183c3fce8637310399bbffa
Submitter: Jenkins
Branch: master

commit af23dd8faeefedcb9183c3fce8637310399bbffa
Author: Trung Trinh <email address hidden>
Date: Tue Nov 4 23:29:29 2014 +1400

    Fix Horizon crash when parsing volume list

    If using Nova or Cinder CLI to create a new volume
    (without name) that can be used to boot a new VM,
    then Horizon will be crashed when the volume list
    is retrieved by clicking the tab "Volumes" on
    Horizon dashboard.

    Change-Id: I9850dca2f6f5ab8eebab035f9e7cf19d7262f7d2
    Closes-Bug: #1389108

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/149522

Revision history for this message
Marcos Lobo (marcos-fermin-lobo) wrote :

Is this possible? I mean, Can I add a volume without name using CLI or Horizon?. I think this patch should be extended to the openstack clients, because, in my opinion, "create a volume without name" is not a good behavior.

Revision history for this message
Trung Trinh (trung-t-trinh) wrote :

Marcos,

It's quite ok to create a volume without name by using CLI. However, after that, if you go to the "Volumes" view on Horizon, then Horizon will be crashed because Horizon always assume that any volume has name!!

Revision history for this message
Marcos Lobo (marcos-fermin-lobo) wrote :

So, there are behavior inconsistencies between different clients (CLIs and Horizon), is it?

What is the use-case to create a volume without name?

Revision history for this message
Trung Trinh (trung-t-trinh) wrote :

Marcos,
Yes, that's right. There exists inconsistency in creating volume between CLI and Horizon dashboard. However, this inconsistency has also been fixed (by me). Here is its link: https://bugs.launchpad.net/horizon/+bug/1389172

We should allow user to create anonymous volume, right? The main thing is that the system must not be crashed in this scenario, right?

Revision history for this message
Marcos Lobo (marcos-fermin-lobo) wrote :

Thanks a lot for the explanation and your work Trung.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/juno)

Reviewed: https://review.openstack.org/149522
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=560357873ee84d10ed88b62e005ab9a81b9a114a
Submitter: Jenkins
Branch: stable/juno

commit 560357873ee84d10ed88b62e005ab9a81b9a114a
Author: Trung Trinh <email address hidden>
Date: Tue Nov 4 23:29:29 2014 +1400

    Fix Horizon crash when parsing volume list

    If using Nova or Cinder CLI to create a new volume
    (without name) that can be used to boot a new VM,
    then Horizon will be crashed when the volume list
    is retrieved by clicking the tab "Volumes" on
    Horizon dashboard.

    (cherry picked from commit af23dd8faeefedcb9183c3fce8637310399bbffa)

    Closes-Bug: #1389108
    Change-Id: I9850dca2f6f5ab8eebab035f9e7cf19d7262f7d2

Thierry Carrez (ttx)
Changed in horizon:
milestone: kilo-1 → 2015.1.0
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.