Bug 1258383

Summary: Failed to update 'query' field for threshold based alarm
Product: Red Hat OpenStack Reporter: Yurii Prokulevych <yprokule>
Component: python-ceilometerclientAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED CURRENTRELEASE QA Contact: Yurii Prokulevych <yprokule>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.0 (RHEL 7)CC: eglynn, jruzicka, mburns, ohochman, pbrady, rhel-osp-director-maint, sclewis, scohen, yeylon
Target Milestone: ---Keywords: ZStream
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-ceilometerclient-1.0.14-2.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-16 15:55:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Some debut output none

Description Yurii Prokulevych 2015-08-31 09:06:56 UTC
Created attachment 1068548 [details]
Some debut output

Description of problem:
Query field for threshold based alarm can be specified during alarm creation but cannot be updated later.
ceilometer alarm-show -a 1517195f-fd22-43fa-ac92-2b932e2c8cd4
+---------------------------+--------------------------------------+
| Property                  | Value                                |
+---------------------------+--------------------------------------+
| alarm_actions             | [u'log://']                          |
| alarm_id                  | 1517195f-fd22-43fa-ac92-2b932e2c8cd4 |
| comparison_operator       | ge                                   |
| description               | Test Alarm Update 2                  |
| enabled                   | True                                 |
| evaluation_periods        | 1                                    |
| exclude_outliers          | False                                |
| insufficient_data_actions | [u'log://']                          |
| meter_name                | image.download                       |
| name                      | TestAlarm1                           |
| ok_actions                | [u'http://127.0.0.1:5000']           |
| period                    | 60                                   |
| project_id                | 2790ac1340294cf4bfb041ccf37a6b2c     |
| query                     |                                      |
| repeat_actions            | False                                |
| state                     | insufficient data                    |
| statistic                 | count                                |
| threshold                 | 3.0                                  |
| type                      | threshold                            |
| user_id                   | 245f374675e04aaaa6928d994a93c497     |
+---------------------------+--------------------------------------+

ceilometer  alarm-threshold-update \
-q 'resource_id=954adc14-8475-4c4e-93b3-17b05733f599' \
-a 1517195f-fd22-43fa-ac92-2b932e2c8cd4

+---------------------------+--------------------------------------+
| Property                  | Value                                |
+---------------------------+--------------------------------------+
| alarm_actions             | [u'log://']                          |
| alarm_id                  | 1517195f-fd22-43fa-ac92-2b932e2c8cd4 |
| comparison_operator       | ge                                   |
| description               | Test Alarm Update 2                  |
| enabled                   | True                                 |
| evaluation_periods        | 1                                    |
| exclude_outliers          | False                                |
| insufficient_data_actions | [u'log://']                          |
| meter_name                | image.download                       |
| name                      | TestAlarm1                           |
| ok_actions                | [u'http://127.0.0.1:5000']           |
| period                    | 60                                   |
| project_id                | 2790ac1340294cf4bfb041ccf37a6b2c     |
| query                     |                                      |
| repeat_actions            | False                                |
| state                     | insufficient data                    |
| statistic                 | count                                |
| threshold                 | 3.0                                  |
| type                      | threshold                            |
| user_id                   | 245f374675e04aaaa6928d994a93c497     |
+---------------------------+--------------------------------------+

ceilometer alarm-history -a 1517195f-fd22-43fa-ac92-2b932e2c8cd4 | tail
| rule change      | 2015-08-31T08:47:45.015000 | rule: image.download >= 3.0 during 1 x 60s  |
| rule change      | 2015-08-31T08:48:05.404000 | repeat_actions: True                        |
| rule change      | 2015-08-31T08:48:13.485000 | repeat_actions: False                       |
| rule change      | 2015-08-31T08:48:36.237000 | rule: image.download >= 3.0 during 1 x 60s  |
| rule change      | 2015-08-31T08:48:47.192000 | rule: image.download >= 3.0 during 1 x 60s  |
| rule change      | 2015-08-31T08:49:59.847000 | rule: image.download >= 5.0 during 1 x 60s  |
| rule change      | 2015-08-31T08:50:05.425000 | rule: image.download >= 3.0 during 1 x 60s  |
| rule change      | 2015-08-31T08:59:20.968000 |                                             |
+------------------+----------------------------+---------------------------------------------+

Version-Release number of selected component (if applicable):
openstack-ceilometer-central-2014.1.5-1.el7ost.noarch
python-ceilometer-2014.1.5-1.el7ost.noarch
python-ceilometerclient-1.0.10-1.el7ost.noarch
openstack-ceilometer-compute-2014.1.5-1.el7ost.noarch
openstack-ceilometer-notification-2014.1.5-1.el7ost.noarch
openstack-ceilometer-alarm-2014.1.5-1.el7ost.noarch
openstack-ceilometer-common-2014.1.5-1.el7ost.noarch
openstack-ceilometer-collector-2014.1.5-1.el7ost.noarch
openstack-ceilometer-api-2014.1.5-1.el7ost.noarch


Expected results:
Query field is updated.

Comment 3 Eoghan Glynn 2015-08-31 12:06:31 UTC
Seem like a python-ceilometerclient oversight, as the threshold_rule query is not set appropriately in the outgoing PUT request.

Comment 4 Yurii Prokulevych 2015-08-31 13:33:06 UTC
Same behaviour while updating user_id or project_id.

Regards,
Yurii

Comment 5 Chris Dent 2015-09-01 13:47:20 UTC
The issue with user_id and project_id is something that has been fixed in a relatively recent version of ceilometerclient (one that is later than Kilo): https://bugs.launchpad.net/python-ceilometerclient/+bug/1395932

Given that this is a pretty long standing bug I'm not sure of the process there?

I'm still working through the issue with query.

Comment 6 Chris Dent 2015-09-01 17:21:55 UTC
To make sure the error is where we think it is, I confirmed that the tests cases work with modern python-ceilometerclient (installed from pypi) and a rhos5 setup. I'm still trying to find the relevant change. It is non obvious. :(

Comment 7 Chris Dent 2015-09-01 17:59:08 UTC
Some more information. The fix was at the commit linked to this bug: https://bugs.launchpad.net/python-ceilometerclient/+bug/1313676

The basic problem is that the v2/shell.py is not assigning the query string to the right destination so it is dropped.

The version of ceilometerclient in rhos5 is 1.0.10. The fix is in 1.0.11 and 1.0.12. The branch tagged 1.0.12 is also tagged 'icehouse-eol'.

Can we just update to a newer packaging of the client? If so, how?