--limit can collide with query string on some commands

Bug #1494245 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Medium
Chris Dent
python-ceilometerclient
Invalid
Medium
Rohit Jaiswal

Bug Description

Using the new 1.5.0 there is some inconsisten behavior on some commands when trying to (naively) mix the use of the --limit command with a limit query. Some examples:

* ceilometer event-list --limit=1 # returns one item
* ceilometer event-list -q limit=1 # returns an empty list

* ceilometer resource-list --limit=1 # returns one item
* ceilometer resource-list -q limit=1 # errors as follows

  get_resources() got multiple values for keyword argument 'limit' (HTTP 500) (Request-ID: req-79132b9a-505e-4a92-bd86-b094f455ee53)

* ceilometer meter-list --limit =1 # returns one item
* ceilometer meter-list -q limit=1 # errors the same way as resource-list

* ceilometer sample-list --limit =1 # returns one item
* ceilometer sample-list -q limit=1 # errors as follows

  Unknown argument: "limit": unrecognized field in query: [<Query u'limit' eq u'1' >], valid keys: ['message_id', 'meter', 'project', 'resource', 'search_offset', 'source', 'timestamp', 'user'] (HTTP 400) (Request-ID: req-9feebef4-3e38-4ed9-91ea-09a005f1733d)

There seem to be at least two bugs here:

* the client is not constructing the right query based on its input, or at least producing an error locally before going to the server
* the server is producing a 500 when it should be producing a 400 when it gets multiple limits

Chris Dent (cdent)
Changed in ceilometer:
assignee: nobody → Chris Dent (chdent)
gordon chung (chungg)
Changed in python-ceilometerclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

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

Changed in ceilometer:
status: New → In Progress
Changed in python-ceilometerclient:
assignee: nobody → Rohit Jaiswal (rohit-jaiswal-3)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/222169
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=05f7ad3f8b65135381ffbb2fab5ed67487c05778
Submitter: Jenkins
Branch: master

commit 05f7ad3f8b65135381ffbb2fab5ed67487c05778
Author: Chris Dent <email address hidden>
Date: Thu Sep 10 12:36:56 2015 +0000

    Avoid 500 errors when duplicating limit queries

    If get_meters() or get_resources() gets >1 limit keyword arguments
    (due to query string processing) they cause a TypeError which
    reaches the user as 500 response code. This is no good, it should be
    a 400.

    Change-Id: I4621aa9c6d35f1545b75443983ba20845a85e170
    Closes-Bug: #1494245

Changed in ceilometer:
status: In Progress → Fix Committed
Revision history for this message
Rohit Jaiswal (rohit-jaiswal-3) wrote :

Not sure if this affects ceilometerclient unless we want to pre-validate this in client before invoking the api. For all 3 - meters, samples and resources, using limit with -q leads to HTTP 400 error from the ceilometer-api, which means client does not validate anything.

Changed in python-ceilometerclient:
status: New → Incomplete
gordon chung (chungg)
Changed in python-ceilometerclient:
status: Incomplete → Invalid
gordon chung (chungg)
Changed in ceilometer:
milestone: none → liberty-rc1
gordon chung (chungg)
Changed in ceilometer:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: liberty-rc1 → 5.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.