Images pagination doesn't really work

Bug #1083034 reported by Kieran Spear
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Kieran Spear

Bug Description

If there are more images or snapshots than API_RESULT_PAGE_SIZE, the dashboard displays every image/snapshot except the last one. In this case, the 'next' button is always shown and when clicked it displays the last image (unless the last image is an aki/ami, then it displays an empty list).

The tests assume that glanceclient.images.list() returns only API_RESULT_PAGE_SIZE results, but it actually returns an iterator that will return all existing images matching the query, so we need to carefully consume from it. The glanceclient pagination seems to be more like buffering.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Agreed. Pagination in the OpenStack APIs is a disaster and largely the bane of my existence. I'm tempted to do away with all of it and just request 9999 items from every API call and document the Horizon currently doesn't support 10,000 or more objects being displayed at once... :-/

Other fixes are welcome, just noting that this is an ongoing problem that extends well beyond Horizon.

Changed in horizon:
importance: Undecided → Medium
milestone: none → grizzly-2
status: New → Confirmed
Changed in horizon:
milestone: grizzly-2 → grizzly-3
Revision history for this message
Kieran Spear (kspear) wrote :

I think just disabling pagination here is the way to go for G3. We currently end up retrieving everything anyway since we use list() on the returned iterator (which triggers http requests until it is exhausted).

Kieran Spear (kspear)
Changed in horizon:
assignee: nobody → Kieran Spear (kspear)
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/22381

Changed in horizon:
status: Confirmed → In Progress
Thierry Carrez (ttx)
Changed in horizon:
milestone: grizzly-3 → grizzly-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

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

commit c822a9f16e92576a637f06908018653a46c23d24
Author: Kieran Spear <email address hidden>
Date: Tue Feb 19 18:38:45 2013 +1100

    Fix images/snapshots table pagination

    For project images, disable pagination entirely as it's not compatible
    with client-side filtering (at least without moving to asynch table
    loading). This can be revisited when we move to glance v2, which
    apparently supports filtering by owner.

    For snapshots and admin images, fix pagination by making sure the
    iterator returned by glanceclient isn't exhausted completely when
    returning a page of images. Do this by slicing just the number of
    images we require (+ 1 to check if there will be another page after
    this one).

    Fixes bug #1083034.

    Change-Id: I692f57dec6dca16cf8909f5b234aadb002702fc8

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