Querying alarm history using severity field breaks the API

Bug #1473046 reported by Kamil Rykowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Aodh
Fix Released
Undecided
Rohit Jaiswal
Ceilometer
Opinion
Medium
Rohit Jaiswal

Bug Description

I've been working on delivering unittests for oslo.versionedobjects - https://blueprints.launchpad.net/ceilometer/+spec/versioned-objects - and hit an issue when calling the alarm history with severity filter.

Here is my sample request:
http://localhost:8777/v2/alarms/<ALARM_ID>/history?q.field=severity&q.op=eq&q.type=string&q.value=severity

Which gives me 500 response:
{
    "error_message": {
        "debuginfo": null,
        "faultcode": "Server",
        "faultstring": "type object 'AlarmChange' has no attribute 'severity'"
    }
}

+ Traceback:

2015-07-09 14:22:09.815 22333 ERROR wsme.api [-] Server-side error: "type object 'AlarmChange' has no attribute 'severity'". Detail:
Traceback (most recent call last):

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

  File "/opt/stack/ceilometer/ceilometer/api/controllers/v2/alarms.py", line 640, in history
    **kwargs)]

  File "/opt/stack/ceilometer/ceilometer/alarm/storage/impl_sqlalchemy.py", line 296, in get_alarm_changes
    query = query.filter(models.AlarmChange.severity == severity)

AttributeError: type object 'AlarmChange' has no attribute 'severity'

Indeed AlarmChange model does not have a field severity (it's only on the Alarm model), so the exception message is pretty obvious.

ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
status: New → Confirmed
importance: Undecided → Medium
Changed in ceilometer:
assignee: nobody → Rohit Jaiswal (rohit-jaiswal-3)
Changed in aodh:
assignee: nobody → Rohit Jaiswal (rohit-jaiswal-3)
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/200238

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

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

Changed in aodh:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ceilometer (master)

Change abandoned by Rohit Jaiswal (<email address hidden>) on branch: master
Review: https://review.openstack.org/200238
Reason: Abandoned in favor of equivalent change in aodh: https://review.openstack.org/#/c/200315/

Changed in ceilometer:
status: In Progress → Opinion
Changed in aodh:
assignee: Rohit Jaiswal (rohit-jaiswal-3) → Chris Dent (chdent)
Changed in aodh:
assignee: Chris Dent (chdent) → Rohit Jaiswal (rohit-jaiswal-3)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to aodh (master)

Reviewed: https://review.openstack.org/200315
Committed: https://git.openstack.org/cgit/openstack/aodh/commit/?id=c0ea892e87d449699a8d9d62c1ea6120a7f9b65f
Submitter: Jenkins
Branch: master

commit c0ea892e87d449699a8d9d62c1ea6120a7f9b65f
Author: Rohit Jaiswal <email address hidden>
Date: Thu Jul 9 20:04:45 2015 +0000

    Fixes querying alarm history with severity field

    Querying alarm-history with the severity field
    fails with a 500 error as the storage model has
    no severity field.

    This fix adds the severity field to AlarmHistory
    table and model and allows search on severity field.

    Change-Id: I4a374d324c7e1bde566e26daf7092fd325f33625
    Closes-Bug: 1473046

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