Attribute error on virtual_size

Bug #1482657 reported by Christoph Seifert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Christoph Seifert
Kilo
Fix Released
Undecided
Unassigned

Bug Description

Version: stable/kilo
Run with ./run_test.py --runserver

Running an old havana glance backend will result in an AttributeError since the attribute is introduced with the icehouse release. See error log at bottom of message. A simple check for the attribute will solve this issue and restore compatibility.

Attached is a patch as proposal.

Regards
Christoph

Error log:

Internal Server Error: /project/instances/launch
Traceback (most recent call last):
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 137, in get_response
    response = response.render()
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/response.py", line 103, in render
    self.content = self.rendered_content
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/response.py", line 80, in rendered_content
    content = template.render(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 148, in render
    return self._render(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 142, in _render
    return self.nodelist.render(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 844, in render
    bit = self.render_node(node, context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/debug.py", line 80, in render_node
    return node.render(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/defaulttags.py", line 525, in render
    six.iteritems(self.extra_context))
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/defaulttags.py", line 524, in <genexpr>
    values = dict((key, val.resolve(context)) for key, val in
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 596, in resolve
    obj = self.var.resolve(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 734, in resolve
    value = self._resolve_lookup(context)
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/django/template/base.py", line 788, in _resolve_lookup
    current = current()
  File "/home/coby/ao/horizon/horizon/workflows/base.py", line 717, in get_entry_point
    step._verify_contributions(self.context)
  File "/home/coby/ao/horizon/horizon/workflows/base.py", line 392, in _verify_contributions
    field = self.action.fields.get(key, None)
  File "/home/coby/ao/horizon/horizon/workflows/base.py", line 368, in action
    context)
  File "/home/coby/ao/horizon/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 147, in __init__
    request, context, *args, **kwargs)
  File "/home/coby/ao/horizon/horizon/workflows/base.py", line 138, in __init__
    self._populate_choices(request, context)
  File "/home/coby/ao/horizon/horizon/workflows/base.py", line 151, in _populate_choices
    bound_field.choices = meth(request, context)
  File "/home/coby/ao/horizon/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py", line 428, in populate_image_id_choices
    if image.virtual_size:
  File "/home/coby/ao/horizon/.venv/lib/python2.7/site-packages/glanceclient/openstack/common/apiclient/base.py", line 494, in __getattr__
    raise AttributeError(k)
AttributeError: virtual_size

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/213054

Changed in horizon:
assignee: nobody → Christoph Seifert (christoph-seifert27)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

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

commit 5805aa066aa2f3dd72dacc5cc692f6b205c8f3c5
Author: Christoph Seifert <email address hidden>
Date: Fri Aug 14 10:08:20 2015 +0200

    Fix attribute error with old glance backend

    Glance (<= Havana) does not provide the virtual_size attribute for
    images. So we first check if it is available to achieve compatibility
    with older Glance versions.

    Change-Id: I5970e8e6c61c4ee562cdc63a77661ad1801bf98d
    Closes-Bug: #1482657

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/214760

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/kilo)

Change abandoned by Christoph Seifert (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/214742
Reason: Wrong change-id.

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

Reviewed: https://review.openstack.org/214760
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=905e92b05374f0c9e1278a353fe2ed70c23d76c6
Submitter: Jenkins
Branch: stable/kilo

commit 905e92b05374f0c9e1278a353fe2ed70c23d76c6
Author: Jenkins <email address hidden>
Date: Wed Aug 19 16:39:25 2015 +0000

    Fix attribute error with old glance backend

    Glance (<= Havana) does not provide the virtual_size attribute for
    images. So we first check if it is available to achieve compatibility
    with older Glance versions.

    Change-Id: I5970e8e6c61c4ee562cdc63a77661ad1801bf98d
    Closes-Bug: #1482657
    (cherry picked from commit a8c0c4b2bddb5f65f67f311e0193617c87b93f1d)

tags: added: in-stable-kilo
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: liberty-3 → 8.0.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.