volume.volume_id used in {% url %}, but appears to be empty

Bug #969162 reported by Tihomir Trifonov on 2012-03-30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
John Postlethwait

Bug Description

Under Nova/Instances&Volumes, Instance>>Details, if there is a volume, created and attached to the instance, it seems that volume.volume_id is empty, and the url resolver raises an error:


Also, after changing the {% url %} to use volume.id - seems to work, but when opening the link for volume details, there is some problem with the attached instance:


Instance name is empty, and the link is not working, resolves to a non-existing Instance URL.

Notes: I've created an instance from a flavor that has no disk volumes in it(0GB). Then launched the instance, created a new volume, and attached the volume to the instance above.

summary: - volume.volume_id used in {% url %}, but appear empty
+ volume.volume_id used in {% url %}, but appears to be empty
Tihomir Trifonov (ttrifonov) wrote :

It seems volume_id is stored as volumeId in the volume object, and this causes the problem ...

Tihomir Trifonov (ttrifonov) wrote :

Also found a nasty bug...

In volume details template, for 'Created at' is used:

    <dt>{% trans "Created" %}</dt>
    <dd>{{ volume.createdAt|parse_date }}</dd>

But the actual property here is volume.created_at. The real problem comes when this is rendered in the template, it goes to nova-client, but as the property is not present in the current object, it tries to do a lazy load:

    def __getattr__(self, k):
        if k not in self.__dict__:
            #NOTE(bcwaldon): disallow lazy-loading if already loaded once
            if not self.is_loaded():
                return self.__getattr__(k)

And this reloads the whole object, thus discarding some modifications we've made to the object in tab.get_context_data() method. This is very dangerous behaviour, as allows for an object to change it's state during template rendering if a property name is mispelled...

Changed in horizon:
assignee: nobody → Tihomir Trifonov (ttrifonov)

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

Changed in horizon:
status: New → In Progress
Changed in horizon:
assignee: Tihomir Trifonov (ttrifonov) → John Postlethwait (john-postlethwait)
Devin Carlen (devcamcar) on 2012-04-02
Changed in horizon:
milestone: none → essex-rc2
importance: Undecided → Critical

Reviewed: https://review.openstack.org/6050
Committed: http://github.com/openstack/horizon/commit/bb1e7e6a5a3f0517ed8178a2572783eeaee17434
Submitter: Jenkins
Branch: master

commit bb1e7e6a5a3f0517ed8178a2572783eeaee17434
Author: Tihomir Trifonov <email address hidden>
Date: Sun Apr 1 12:04:13 2012 +0300

    volume.volumeId property used wrongly as .volume_id

    Fixes bug 969162

    Also, the created_at property was used as createdAt,
    which lead to object reloading during template render
    due to missing prop. See bug desc for more details.
    Also, in the volume details template, the url link
    for instance details was wrong - it was the link for
    volume details instead.

    Fixes Bug 971150

    Change-Id: If5cfd515d0726a9ab85021b904a53e94b80205ea

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-04-03
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in horizon:
milestone: essex-rc2 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers