novaclient support for offset

Bug #1001345 reported by clayg on 2012-05-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Low
Anita Kuno

Bug Description

The novaclient does not appear to support (or I don't know how to use) the offset parameter when doing listings. This seems to effect most/all collections. (e.g. instances, volumes, and most notably volume-snapshots, of which there can be "lots-ish".)

Either way, when your result set exceeds the default api limit (1000?) you get some surprising behavior. If you ask for "nova volume-snapshot-show <display_name>" you'll get an error:

    $nova volume-snapshot-show <display_name>
    ERROR: No snapshot with a name or ID of '<display_name>' exists.

Where as a "nova volume-snapshot-show <uuid>" will just make the GET directly on the resource, and of course works as expected.

Unfortunately, I can't figure out how to get the uuid of the volume without dropping down to curl and doing offset queries.

Seems like the client could automatically make extra request(s) if the result set is exactly the same length as a negotiated/default "limit" and may have been truncated? Or at least support offset as a command like option?

Brian Waldon (bcwaldon) wrote :

Yes, this is where you file bugs on python-novaclient.

description: updated
Brian Waldon (bcwaldon) wrote :

The current glance client (in openstack/glance, not openstack/python-glanceclient) does this for pagination. It essentially creates a generator over a sequence of GET /images?limit=X calls, preventing end-users from having to know about pagination at all. Additionally, the more advanced users can pass in marker/limit using --marker and --limit. It would definitely make sense for novaclient to be a bit smarter about it.

Changed in nova:
status: New → Triaged
importance: Undecided → Low
Thierry Carrez (ttx) on 2012-07-04
affects: nova → python-novaclient
Anita Kuno (anteaya) on 2013-01-02
Changed in python-novaclient:
assignee: nobody → Anita Kuno (akuno)
Anita Kuno (anteaya) wrote :

Quoting bcwaldon "The current glance client (in openstack/glance, not openstack/python-glanceclient) does this for pagination. It essentially creates a generator over a sequence of GET /images?limit=X calls, preventing end-users from having to know about pagination at all. Additionally, the more advanced users can pass in marker/limit using --marker and --limit. It would definitely make sense for novaclient to be a bit smarter about it."

Since both glanceclient and keystone contain pagination code, I would like to put it in an olso library: https://blueprints.launchpad.net/oslo/+spec/pagination-generator

Note pagination in glanceclient currently has a bug: https://bugs.launchpad.net/python-glanceclient/+bug/1115677

Anita Kuno (anteaya) wrote :

The glanceclient bug I linked to above has turned out upon further investigation to not be a bug, it was a mistake of understanding on my part.

I will address nova volume-snapshot-show for this bug. As you can see from this updated blueprint: https://blueprints.launchpad.net/oslo/+spec/pagination-generator there are a number of places to call the pagination code in novaclient, so creating a pagination library called from multiple functions feels more practical long term.

Changed in python-novaclient:
status: Triaged → In Progress

Reviewed: https://review.openstack.org/22129
Committed: http://github.com/openstack/python-novaclient/commit/8811ced00738059d4aee9db0d586eb8724bb1055
Submitter: Jenkins
Branch: master

commit 8811ced00738059d4aee9db0d586eb8724bb1055
Author: Anita Kuno <email address hidden>
Date: Sun Feb 17 01:53:40 2013 +0000

    Added limit to image-list in a preparatory step toward addressing bug 1001345.

    Currently novaclient doesn't use the limit or marker params.
    As a step to addressing bug 1001345 which requires pagination,
    this patch introduces the use of limit as an option
    passed to the image-list function.

    Change-Id: Ia32f9e923b4eb9bcdde3b7bc1722c59d7791d104

Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in python-novaclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers