project id is missing for alarm create

Bug #1393489 reported by ZhiQiang Fan
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-ceilometerclient
Fix Released
Undecided
ZhiQiang Fan

Bug Description

with latest devstack, ceilometer, python-ceilometerclient, (2014-11-18), and set env with devstack/accrc/admin/admin

$ ceilometer --debug alarm-threshold-create --name test-project-id --meter instance --threshold 1
DEBUG (client) REQ: curl -i -X 'POST' 'http://127.0.0.1:8777/v2/alarms' -H 'User-Agent: ceilometerclient.openstack.common.apiclient' -H 'Content-Type: application/json' -H 'X-Auth-Token: 51e87a74f9aa4d84b562468a4cc6249e'
DEBUG (client) REQ BODY: {"threshold_rule": {"threshold": 1.0, "meter_name": "instance"}, "project_id": "", "type": "threshold", "name": "test-project-id", "repeat_actions": false}

+---------------------------+--------------------------------------------------------+
| Property | Value |
+---------------------------+--------------------------------------------------------+
| alarm_actions | [] |
| alarm_id | f8910e62-3490-4fc3-8e0d-4a211b06d83f |
| comparison_operator | eq |
| description | Alarm when instance is eq a avg of 1.0 over 60 seconds |
| enabled | True |
| evaluation_periods | 1 |
| exclude_outliers | False |
| insufficient_data_actions | [] |
| meter_name | instance |
| name | test-project-id |
| ok_actions | [] |
| period | 60 |
| project_id | |
| query | |
| repeat_actions | False |
| state | insufficient data |
| statistic | avg |
| threshold | 1.0 |
| type | threshold |
| user_id | dddb336a7f9740b9910ba5eb8f8edeeb |
+---------------------------+--------------------------------------------------------+

Note that project_id is '', actually it should be the admin's project_id

This is because the AuthPlugin we introduced recently, which sets project_id in class attribute opt_names, which will be added to cli_argument with default value '' in openstack/common/apiclient/auth.py

ZhiQiang Fan (aji-zqfan)
Changed in python-ceilometerclient:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
Revision history for this message
Putta Challa (puttachalla) wrote :

This is an issue for alarm-threshold-update as well.

DEBUG (client) REQ: curl -i -X 'PUT' 'http://192.168.126.129:8777/v2/alarms/4cd967cb-74c3-4526-a8f2-899ca7dc45b6' -H 'User-Agent: ceilometerclient.openstack.common.apiclient' -H 'Content-Type: application/json' -H 'X-Auth-Token: 9596702b97f74d34a961116f6b65d0ac'
DEBUG (client) REQ BODY: {"alarm_actions": [], "ok_actions": [], "name": "alarm3", "state": "ok", "timestamp": "2014-11-20T18:34:40.105478", "enabled": true, "state_timestamp": "2014-11-20T18:45:17.286697", "threshold_rule": {"meter_name": "image", "evaluation_periods": 1, "period": 60, "statistic": "avg", "threshold": 10.0, "query": [], "comparison_operator": "eq", "exclude_outliers": false}, "alarm_id": "4cd967cb-74c3-4526-a8f2-899ca7dc45b6", "time_constraints": [], "insufficient_data_actions": [], "repeat_actions": false, "user_id": "ea9817c1e4d2468daede7d586de4c8c6", "project_id": "", "type": "threshold", "description": "test alarm created with project-id"}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ceilometerclient (master)

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

Changed in python-ceilometerclient:
status: New → In Progress
Changed in python-ceilometerclient:
assignee: ZhiQiang Fan (aji-zqfan) → gordon chung (chungg)
gordon chung (chungg)
Changed in python-ceilometerclient:
assignee: gordon chung (chungg) → ZhiQiang Fan (aji-zqfan)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ceilometerclient (master)

Reviewed: https://review.openstack.org/139659
Committed: https://git.openstack.org/cgit/openstack/python-ceilometerclient/commit/?id=0c23c62cef6f1388d26c04d6cf0e74153db0a0b5
Submitter: Jenkins
Branch: master

commit 0c23c62cef6f1388d26c04d6cf0e74153db0a0b5
Author: ZhiQiang Fan <email address hidden>
Date: Thu Nov 27 04:35:12 2014 +0800

    Enable specified project_id in CLI commands

    After we port to oslo-incubator.apiclient, the project_id can no
    longer be specified for alarm-{,threhsold,combination}-{create,update}
    and sample-create, this is because client.AuthPlugin registers a CLI
    argument named --os-project-id which will shadow the project-id
    argument.

    Since os-project-id is used for Keystone V3 API, we should not
    remove it from AuthPlugin, so this patch moves the dest of project_id
    to {alarm,sample}_project_id, and adds a decorator to restore shadowed
    project_id field when we call v2 client.

    Change-Id: I0ce2416dccd61eb50584799e6df0b8c45d44cdda
    Closes-Bug: #1393489

Changed in python-ceilometerclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ceilometerclient (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/174361

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ceilometerclient (stable/kilo)

Reviewed: https://review.openstack.org/174361
Committed: https://git.openstack.org/cgit/openstack/python-ceilometerclient/commit/?id=40d7913cee4a3e6c133c51caec93c5820473cee3
Submitter: Jenkins
Branch: stable/kilo

commit 40d7913cee4a3e6c133c51caec93c5820473cee3
Author: ZhiQiang Fan <email address hidden>
Date: Thu Nov 27 04:35:12 2014 +0800

    Enable specified project_id in CLI commands

    After we port to oslo-incubator.apiclient, the project_id can no
    longer be specified for alarm-{,threhsold,combination}-{create,update}
    and sample-create, this is because client.AuthPlugin registers a CLI
    argument named --os-project-id which will shadow the project-id
    argument.

    Since os-project-id is used for Keystone V3 API, we should not
    remove it from AuthPlugin, so this patch moves the dest of project_id
    to {alarm,sample}_project_id, and adds a decorator to restore shadowed
    project_id field when we call v2 client.

    Change-Id: I0ce2416dccd61eb50584799e6df0b8c45d44cdda
    Closes-Bug: #1393489
    (cherry picked from commit 0c23c62cef6f1388d26c04d6cf0e74153db0a0b5)

tags: added: in-stable-kilo
Changed in python-ceilometerclient:
milestone: none → 1.3.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.