Volume snapshots table makes 2N+1 volume_get requests

Bug #1218259 reported by Kieran Spear
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Kieran Spear

Bug Description

The volume snapshots table has a column that shows the associated volume name and links to its volume detail page. This calls volume_get twice for each snapshot, so loading the Images & Snapshots page takes forever if you have a decent number of snapshots.

class SnapshotVolumeNameColumn(tables.Column):
    def get_raw_data(self, snapshot):
        request = self.table.request
        volume_name = api.cinder.volume_get(request,
                                            snapshot.volume_id).display_name
        return safestring.mark_safe(volume_name)

    def get_link_url(self, snapshot):
        volume_id = api.cinder.volume_get(self.table.request,
                                          snapshot.volume_id).id
        return reverse(self.link, args=(volume_id,))

https://github.com/openstack/horizon/blob/d45413e9bfc5c0730ce10daa4251cfbff086f3b4/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tables.py#L71

We should be calling volume_list once in the view and associating the snapshot with the volume there.

Kieran Spear (kspear)
Changed in horizon:
assignee: nobody → Kieran Spear (kspear)
description: updated
Changed in horizon:
status: New → Confirmed
Changed in horizon:
importance: Undecided → Medium
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/47095

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

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

commit f4d56fb134d7ec0be215b1794ab3e4c3382e5b2a
Author: Kieran Spear <email address hidden>
Date: Wed Sep 18 15:28:40 2013 +1000

    Fix excessive volume_get requests in snaps table

    The volume snapshots table has a column that shows the associated volume
    name and links to its volume detail page. This calls volume_get twice
    for each snapshot, so loading the Images & Snapshots page takes forever
    if you have a decent number of snapshots.

    This commit instead gets the volume list at the same time as the
    volume snapshot list, and stores the volume as an attribute on
    the snapshot so it can be easily retrieved later.

    Closes-bug: 1218259
    Change-Id: I004e50aae51a6ed7549da41967bc42babfa6cb45

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-rc1 → 2013.2
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.