iotop/0009-Improve-the-message-that-is-printed-when-Linux-tasks.patch

63 lines
2.5 KiB
Diff
Raw Permalink Normal View History

From f079550490496eb1008fe73620ab5db3bd4a99a8 Mon Sep 17 00:00:00 2001
From: Paul Wise <pabs3@bonedaddy.net>
Date: Thu, 3 May 2018 11:06:09 +0800
Subject: [PATCH 09/11] Improve the message that is printed when Linux
taskstats are not found
Usually this means that iotop is being run in a container.
The Linux kernel doesn't support taskstats outside the host net namespace.
There was a patch that looks like it may fix this but it never got merged.
Traceback (most recent call last):
File "/usr/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 737, in main
main_loop()
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 727, in <lambda>
main_loop = lambda: run_iotop(options)
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 618, in run_iotop
return run_iotop_window(None, options)
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 609, in run_iotop_window
taskstats_connection = TaskStatsNetlink(options)
File "/usr/lib/python3/dist-packages/iotop/data.py", line 151, in __init__
self.family_id = controller.get_family_id('TASKSTATS')
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 76, in get_family_id
m = GeNlMessage.recv(self.conn)
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 56, in recv
msg = conn.recv()
File "/usr/lib/python3/dist-packages/iotop/netlink.py", line 255, in recv
raise err
OSError: Netlink error: No such file or directory (2)
See-also: https://blog.outlyer.com/using-netlink-to-calculate-load-averages
See-also: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg924689.html
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1290691
See-also: https://bugs.openvz.org/browse/OVZ-5655
---
iotop/ui.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/iotop/ui.py b/iotop/ui.py
index 848c42b..328dafe 100644
--- a/iotop/ui.py
+++ b/iotop/ui.py
@@ -520,6 +520,15 @@ configure sudo to allow you to run iotop as root.
Please do not file bugs on iotop about this.''', file=sys.stderr)
sys.exit(1)
+ if e.errno == errno.ENOENT:
+ print(e, file=sys.stderr)
+ print('''
+The Linux kernel interfaces that iotop relies on for process I/O statistics
+were not found. Please enable CONFIG_TASKSTATS in your Linux kernel build
+configuration, use iotop outside a container and or share the host's
+network namespace with the container.
+
+Please do not file bugs on iotop about this.''', file=sys.stderr
else:
raise
--
1.8.3.1