statistic broken when getting no sample of the specified meter

Bug #1292322 reported by Liusheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Low
Liusheng

Bug Description

My environment deployed with mysql db, hen I use the command like this:

ceilometer statistics -m instance -p 5000 -g resource_id -q "user=a992a76cd84041b88718dc0263ac72b1"

here, the 'user' with 'a992a76cd84041b88718dc0263ac72b1' is not exists.

the ceilometer CLI will return an 500 error.

the traces in ceilometer-api.log is:

2014-03-14 10:25:30.193 8821 DEBUG ceilometer.api.controllers.v2 [-] computed value coming from <ceilometer.storage.impl_sqlalchemy.Connection object at 0x2763710> statistics /opt/stack/ceilometer/ceilometer/api/controllers/v2.py:902
2014-03-14 10:38:20.282 8821 ERROR wsme.api [-] Server-side error: "unsupported operand type(s) for -: 'NoneType' and 'NoneType'". Detail:
Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/wsmeext/pecan.py", line 77, in callfunction
    result = f(self, *args, **kwargs)

  File "/opt/stack/ceilometer/ceilometer/api/controllers/v2.py", line 915, in statistics
    for c in computed]

  File "/opt/stack/ceilometer/ceilometer/storage/impl_sqlalchemy.py", line 785, in get_meter_statistics
    period):

  File "/opt/stack/ceilometer/ceilometer/storage/base.py", line 45, in iter_period
    timeutils.delta_seconds(start, end)

  File "/opt/stack/ceilometer/ceilometer/openstack/common/timeutils.py", line 184, in delta_seconds
    delta = after - before

TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

Liusheng (liusheng)
Changed in ceilometer:
assignee: nobody → Liusheng (liusheng)
Liusheng (liusheng)
description: updated
Changed in ceilometer:
status: New → In Progress
Revision history for this message
Liusheng (liusheng) wrote :
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/82048

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to ceilometer (master)

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

commit d92d25ab062568ebaeed984f528567c410479b90
Author: liu-sheng <email address hidden>
Date: Fri Mar 14 11:26:33 2014 +0800

    Fix the return of statistic with getting no sample

    In mysql scenario, when getting statistics with no sample
    (this can be presented with invalid value of sample filters), ceilometer
    will raise an error about NoneType.
    Like other API of ceilometer, it should return an empty list.

    Change-Id: I07cbc3f03f7a5e6751e6851f14ed1cdc16ee4a4c
    Closes-bug: #1292322

Changed in ceilometer:
status: In Progress → Fix Committed
gordon chung (chungg)
Changed in ceilometer:
importance: Undecided → Low
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → juno-1
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: juno-1 → 2014.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.