aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-04-22 18:41:20 +0100
committerBryn M. Reeves <bmr@redhat.com>2013-04-22 18:41:20 +0100
commit2b3807aef2894c4ccbc9d6815c1f00dbec3b4a06 (patch)
tree04fc38111c3334b0a43609ad0cf1807e9fceefa0
parent4b640932274936fc3cb630fe8de5b4b73dfbe3e3 (diff)
downloadsos-2b3807aef2894c4ccbc9d6815c1f00dbec3b4a06.tar.gz
Fix modinfo collection
The modinfo collection for the set of loaded modules was using a nasty handrolled pipeline of lsmod | cut |.. to generate a list of module names to pass to modinfo. Rip all that out and replace it with an os.listdir('/sys/module'). Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/kernel.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 4ebf3575..eb15ee43 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -18,22 +18,20 @@ import os
class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""kernel related information
"""
- option_list = [("modinfo", 'gathers information on all kernel modules', 'fast', True)]
- module_file = ""
+
+ sys_module = '/sys/module'
def setup(self):
+ # compat
self.add_cmd_output("uname -a", root_symlink = "uname")
- self.module_file = self.get_cmd_output_now("lsmod", root_symlink = "lsmod")
-
- if self.get_option('modinfo'):
- runcmd = ""
- ret, mods, rtime = self.call_ext_prog('lsmod | cut -f1 -d" " 2>/dev/null | grep -v Module 2>/dev/null')
- for kmod in mods.split('\n'):
- if '' != kmod.strip():
- runcmd = runcmd + " " + kmod
- if len(runcmd):
- self.add_cmd_output("modinfo " + runcmd)
-
+ self.add_cmd_output("lsmod", root_symlink = "lsmod")
+
+ try:
+ modules = os.listdir(sys_module)
+ self.add_cmd_output("modinfo " + " ".join(modules))
+ except OSError:
+ self.soslog.error("could not list %s" % sys_module)
+
self.add_cmd_output("sysctl -a")
self.add_copy_specs([
"/proc/sys/kernel/random/boot_id",