aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-04-29 18:18:37 +0100
committerBryn M. Reeves <bmr@redhat.com>2013-04-29 18:18:37 +0100
commitb52ce08e40621bbc2a386b24138c3bbc0d429220 (patch)
treebffa680ab7608a8fb6914af47a6f711648aba37b
parent4bbff77d3ef78eb60298e3620b5f4dc5413aefa2 (diff)
downloadsos-b52ce08e40621bbc2a386b24138c3bbc0d429220.tar.gz
Move all block device data from filesys to block module
The filesys module has long had a lot of (very weird) code for detecting and processing a list of whole-disk devices in the system. Apart from being garbage this doesn't really belong in the file systems module - move it to block and replace the hokey /proc-and-hdparm-or-regex thing with the existing directory walk over /sys/block. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/block.py14
-rw-r--r--sos/plugins/filesys.py43
2 files changed, 14 insertions, 43 deletions
diff --git a/sos/plugins/block.py b/sos/plugins/block.py
index 895492b0..f54f6fd6 100644
--- a/sos/plugins/block.py
+++ b/sos/plugins/block.py
@@ -25,12 +25,16 @@ class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
# legacy location for non-/run distributions
self.add_copy_spec("/etc/blkid.tab")
self.add_copy_spec("/run/blkid/blkid.tab")
+ self.add_cmd_output("lsblk")
+ self.add_cmd_output("blkid -c /dev/null")
self.add_cmd_output("ls -lanR /dev")
self.add_cmd_output("ls -lanR /sys/block")
if os.path.isdir("/sys/block"):
- for disk in os.listdir("/sys/block"):
- if disk in [ ".", ".." ] or disk.startswith("ram"):
- continue
- self.add_cmd_output("udevadm info -ap /sys/block/%s" % (disk))
-
+ for disk in os.listdir("/sys/block"):
+ if disk in [ ".", ".." ] or disk.startswith("ram"):
+ continue
+ disk_path = os.path.join('/dev/', disk)
+ self.add_cmd_output("udevadm info -ap /sys/block/%s" % (disk))
+ self.add_cmd_output("parted -s %s print" % (disk_path))
+ self.add_cmd_output("fdisk -l %s" % disk_path)
diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py
index 1f06e981..45a49e6b 100644
--- a/sos/plugins/filesys.py
+++ b/sos/plugins/filesys.py
@@ -31,48 +31,15 @@ class Filesys(Plugin, RedHatPlugin, UbuntuPlugin):
"/proc/filesystems",
"/etc/fstab",
"/proc/self/mounts",
- "/proc/mounts",
- "/proc/mdstat",
- "/etc/raidtab",
- "/etc/mdadm.conf"])
- self.get_cmd_output_now("mount -l", root_symlink = "mount")
-
- self.add_cmd_output("findmnt")
+ "/proc/mounts"
+ ])
+ self.add_cmd_output("mount -l", root_symlink = "mount")
self.add_cmd_output("df -al", root_symlink = "df")
self.add_cmd_output("df -ali")
+ self.add_cmd_output("findmnt")
+
if self.get_option('lsof'):
self.add_cmd_output("lsof -b +M -n -l -P", root_symlink = "lsof")
- self.add_cmd_output("blkid -c /dev/null")
- self.add_cmd_output("lsblk")
-
- part_titlep = re.compile("^major")
- blankp = re.compile("^$")
- partlist = []
- devlist = []
- try:
- for line in open('/proc/partitions'):
- if((bool(part_titlep.match(line))) | (bool(blankp.match(line)))):
- continue
- partlist.append('/dev/' + line.split()[-1])
- except IOError:
- exit(1)
- if os.path.exists("hdparm"):
- for dev in partlist:
- ret, hdparm, time = self.call_ext_prog('hdparm -g %s' %(dev))
- if(ret == 0):
- start_geo = hdparm.strip().split("\n")[-1].strip().split()[-1]
- if(start_geo == "0"):
- devlist.append(dev)
- else:
- # Cheaper heuristic as RHEL* does not ship hdparm for S390(x)
- # Skips least dm-.* correctly
- part_in_disk = re.compile("^/dev/[a-z]+$")
- for dev in partlist:
- if bool(part_in_disk.match(dev)):
- devlist.append(dev)
-
- for i in devlist:
- self.add_cmd_output("parted -s %s print" % (i))
if self.get_option('dumpe2fs'):
mounts = '/proc/mounts'