filter “level” in event list

Bug #1628421 reported by miaohb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
senlin
Fix Released
Low
miaohb

Bug Description

The filter “level" is invalid when doing "event list"

stack@tecs:/home/tecs$ openstack cluster event list --filters level=20
+----------+-----------+----------+----------+-----------+-----------------------+-----------+--------------------------------+-------+
| id | timestamp | obj_type | obj_id | obj_name | action | status | status_reason | level |
+----------+-----------+----------+----------+-----------+-----------------------+-----------+--------------------------------+-------+
| 7a93f74d | | CLUSTER | 0be1e099 | mycluster | CLUSTER_CREATE | SUCCEEDED | Cluster creation succeeded. | 20 |
| 9374e7bd | | CLUSTER | 0be1e099 | mycluster | CLUSTER_CREATE | START | The action is being processed. | 20 |
| 10b6ee0a | | NODE | 687b804e | node1 | NODE_CREATE | START | The action is being processed. | 20 |
| d1dab66d | | NODE | 687b804e | node1 | NODE_CREATE | FAILED | Node creation failed. | 40 |
| 550f15bb | | NODE | 61955335 | node2 | NODE_CREATE | START | The action is being processed. | 20 |

function event_list in senlin/engine/service.py:

......
        if filters and consts.EVENT_LEVEL in filters: —— Firstly, filters={'level':'20'}
            value = filters.pop(consts.EVENT_LEVEL) —— Here,value=20
            value = utils.parse_level_values(value) —— value=None
            if value is not None:
                filters[consts.EVENT_LEVEL] = value —— filters['level']=None
......

miaohb (miao-hongbao)
Changed in senlin:
assignee: nobody → miaohb (miao-hongbao)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to senlin (master)

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

Revision history for this message
miaohb (miao-hongbao) wrote :

In client, the value of level should use strings such as DEBUG\INFO\WARNING\ERROR\CRITICAL, rather than numbers.
By doing so, the filter can work well.

stack@tecs:/home/tecs$ openstack cluster event list --filters level=ERROR
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+
| id | timestamp | obj_type | obj_id | obj_name | action | status | level | cluster_id |
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+
| d1dab66d | | NODE | 687b804e | node1 | NODE_CREATE | FAILED | 40 | |
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+

According to Doctor Teng's advice, this patch will try to return symbolic levels instead of numbers when showing users the data. Like below:
stack@tecs:/home/tecs$ openstack cluster event list --filters level=ERROR
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+
| id | timestamp | obj_type | obj_id | obj_name | action | status | level | cluster_id |
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+
| d1dab66d | | NODE | 687b804e | node1 | NODE_CREATE | FAILED | ERROR | |
+----------+-----------+----------+----------+----------+-------------+--------+-------+------------+

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to senlin (master)

Reviewed: https://review.openstack.org/378432
Committed: https://git.openstack.org/cgit/openstack/senlin/commit/?id=8e8df45c2598859a2e3a32e45d8ea651c419c0e0
Submitter: Jenkins
Branch: master

commit 8e8df45c2598859a2e3a32e45d8ea651c419c0e0
Author: miaohb <email address hidden>
Date: Wed Sep 28 17:03:49 2016 +0800

    Display symbolic levels instead of numbers in event list

    Closed-Bug: 1628421
    Display symbolic levels instead of numbers in event list and show

    Change-Id: Ia2931970344f59eb461894a3a0087495a7a19ebf

miaohb (miao-hongbao)
Changed in senlin:
status: In Progress → Fix Committed
Qiming Teng (tengqim)
Changed in senlin:
status: Fix Committed → Fix Released
importance: Undecided → Low
milestone: none → ocata-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.