Bug 1828904
| Summary: | ovs-dpctl-top is broken and can't parse flows | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Fast Datapath | Reporter: | Flavio Leitner <fleitner> |
| Component: | openvswitch2.11 | Assignee: | Timothy Redaelli <tredaelli> |
| Status: | ASSIGNED --- | QA Contact: | Rick Alongi <ralongi> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | FDP 20.E | CC: | ctrautma, jhsiao, ralongi, tredaelli |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| URL: | https://patchwork.ozlabs.org/project/openvswitch/patch/ccbe8452bee9696528daba75a2ab148ee64dd8fa.1620841473.git.tredaelli@redhat.com/ | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 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: | |||
2.11 script with the above patch applied:
[root@rhel7ovs ~]# ./ovs-dpctl-top.in
Flow Summary
Total: 4 errors: 1 Accumulate: off Duration: 0:00:00.012474
DESC
FIELDS (IN_PORT) COUNT PACKETS BYTES AVERAGE
in_port(2) 2 1239 121422 98
in_port(3) 2 1239 121422 98
[root@rhel7ovs ~]#
# ovs-dpctl dump-flows | ./ovs-dpctl-top.in --script --verbose
2020-04-28T14:54:46Z|00001|dpif_netlink|INFO|The kernel module does not support meters.
INFO:root:reading flows from stdin
Flow Summary
Total: 4 errors: 0 Accumulate: off Duration: 0:00:00.000050
DESC
FIELDS (ALL) COUNT PACKETS BYTES AVERAGE
eth_type(0x0806) 2 0 0 0
eth(src=b6:5e:d5:77:97:45,dst=ca:0f:07:39:48:fd) 2 1210 118580 98
in_port(2) 2 1210 118580 98
in_port(3) 2 1210 118580 98
eth_type(0x0800) 2 2420 237160 98
eth(src=ca:0f:07:39:48:fd,dst=b6:5e:d5:77:97:45) 2 1210 118580 98
The following cmd leads to parse errors due to the "eth()" field:
# ovs-dpctl dump-flows | ovs-dpctl-top --script --verbose
INFO:root:reading flows from stdin
ERROR:root:can't parse >eth()<
[..]
ERROR:root:can't parse >eth()<
ERROR:root:can't parse >eth()<
Flow Summary
Total: 0 errors: 230 Accumulate: off Duration: 0:00:00.000036
DESC
FIELDS (ALL) COUNT PACKETS BYTES AVERAGE
Replacing eth() works:
ovs-dpctl dump-flows | sed 's/,eth()//g' | ovs-dpctl-top --script --verbose
INFO:root:reading flows from stdin
Flow Summary
Total: 265 errors: 0 Accumulate: off Duration: 0:00:00.000024
[..]
Currently ovs-dpctl-top, from master, has some problems and the backport doesn't fix all of them. Recent (since efde188622aea5c2137e931f4a446c511676ba32) ovs releases prints "eth()" to dump-flows and this completely breaks ovs-dpctl-top (see Comment 2). With python3 pipe doesn't work since unbuffered mode can't work with pipes: Traceback (most recent call last): File "utilities/ovs-dpctl-top.in", line 1294, in <module> sys.exit(main()) File "utilities/ovs-dpctl-top.in", line 1288, in main flows_script(args) File "utilities/ovs-dpctl-top.in", line 1237, in flows_script ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0) File "/usr/lib64/python3.8/os.py", line 1023, in fdopen return io.open(fd, *args, **kwargs) ValueError: can't have unbuffered text I/O I'll send a series upstream to address all the issues above and then I'll backport those on our ovs2.13 and the non-python3 patches on our ovs2.11 |
Description of problem: Can't use the tool because it breaks right away: [root@rhel7ovs ~]# /usr/bin/ovs-dpctl-top Traceback (most recent call last): File "/usr/bin/ovs-dpctl-top", line 1290, in <module> sys.exit(main()) File "/usr/bin/ovs-dpctl-top", line 1282, in main flows_top(args) File "/usr/bin/ovs-dpctl-top", line 1191, in flows_top flows_read(ihdl, flow_db) File "/usr/bin/ovs-dpctl-top", line 593, in flows_read flow_db.flow_line_add(line) File "/usr/bin/ovs-dpctl-top", line 988, in flow_line_add self.flow_event(fields_dict, stats_old_dict, stats_dict) File "/usr/bin/ovs-dpctl-top", line 1080, in flow_event matches = flow_aggregate(fields_dict, stats_new_dict) File "/usr/bin/ovs-dpctl-top", line 576, in flow_aggregate field, stats_dict) File "/usr/bin/ovs-dpctl-top", line 250, in element_ipv4_get element_show = fmt % (field_type, element["src"], element["dst"]) KeyError: 'src' [root@rhel7ovs ~]# Or running as script: [root@rhel7ovs ~]# ovs-dpctl dump-flows | /usr/bin/ovs-dpctl-top --script --verbose 2020-04-28T14:48:23Z|00001|dpif_netlink|INFO|The kernel module does not support meters. INFO:root:reading flows from stdin Traceback (most recent call last): File "/usr/bin/ovs-dpctl-top", line 1290, in <module> sys.exit(main()) File "/usr/bin/ovs-dpctl-top", line 1284, in main flows_script(args) File "/usr/bin/ovs-dpctl-top", line 1235, in flows_script flow_db = flows_read(ihdl, flow_db) File "/usr/bin/ovs-dpctl-top", line 593, in flows_read flow_db.flow_line_add(line) File "/usr/bin/ovs-dpctl-top", line 988, in flow_line_add self.flow_event(fields_dict, stats_old_dict, stats_dict) File "/usr/bin/ovs-dpctl-top", line 1080, in flow_event matches = flow_aggregate(fields_dict, stats_new_dict) File "/usr/bin/ovs-dpctl-top", line 576, in flow_aggregate field, stats_dict) File "/usr/bin/ovs-dpctl-top", line 250, in element_ipv4_get element_show = fmt % (field_type, element["src"], element["dst"]) KeyError: 'src' [root@rhel7ovs ~]# Version-Release number of selected component (if applicable): openvswitch2.11-2.11.0-50.el7fdp.x86_64 How reproducible: Always Steps to Reproduce: 1. Install openvswitch2.11 2. Start the service 3. Bring up an ovs bridge, attach some ports, generate some traffic 4. run the tool above The following patch from upstream fixes the issue: commit 96b2c715efc560b5a094d900d5be7723d66b6475 Author: Jaime Caamaño Ruiz <jcaamano> Date: Mon Aug 12 18:52:27 2019 +0200 utilities: Improve ovs-dpctl-top flow parsing * check that expected bytes and packets stats are correctly read from every flow. * check that the expected elements are read for every field type aggregation. Signed-off-by: Jaime Caamaño Ruiz <jcaamano> Signed-off-by: Ben Pfaff <blp>