summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorTimothy Redaelli <tredaelli@redhat.com>2021-05-12 19:44:33 +0200
committerIlya Maximets <i.maximets@ovn.org>2022-11-30 15:10:49 +0100
commitcd475f976512bd1ce3abaf325c835780c37d6386 (patch)
tree8e46294dd704a5198a7adc5c003138e64b0bc466 /utilities
parent59e8cb8a053d50f49629be8b6fd614562d066404 (diff)
downloadopenvswitch-cd475f976512bd1ce3abaf325c835780c37d6386.tar.gz
ovs-dpctl-top: Fix ovs-dpctl-top via pipe.
Currently it's not possible to use ovs-dpctl-top via pipe (eg: ovs-dpctl dump-flows | ovs-dpctl-top --script --verbose) since Python3 doesn't allow to open a file (stdin in our case) in binary mode without buffering enabled. This commit changes the behaviour in order to directly pass stdin to flows_read instead of re-opening it without buffering. Signed-off-by: Timothy Redaelli <tredaelli@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'utilities')
-rwxr-xr-xutilities/ovs-dpctl-top.in6
1 files changed, 1 insertions, 5 deletions
diff --git a/utilities/ovs-dpctl-top.in b/utilities/ovs-dpctl-top.in
index fbe6e4f56..2c1766eff 100755
--- a/utilities/ovs-dpctl-top.in
+++ b/utilities/ovs-dpctl-top.in
@@ -1236,11 +1236,7 @@ def flows_script(args):
if (args.flowFiles is None):
logging.info("reading flows from stdin")
- ihdl = os.fdopen(sys.stdin.fileno(), 'r', 0)
- try:
- flow_db = flows_read(ihdl, flow_db)
- finally:
- ihdl.close()
+ flow_db = flows_read(sys.stdin, flow_db)
else:
for flowFile in args.flowFiles:
logging.info("reading flows from %s", flowFile)