aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-04-25 18:00:01 +0100
committerBryn M. Reeves <bmr@redhat.com>2013-04-25 18:00:01 +0100
commitae0ed73bc855171b353fd0cf42a6dd75755b8c80 (patch)
tree26656696ba430f311f1afebdcbe2569abe8bdd3d
parentb9613ed4d4544f8f141ae66e0948648952d49274 (diff)
downloadsos-ae0ed73bc855171b353fd0cf42a6dd75755b8c80.tar.gz
Break up the device-mapper trainwreck
Break the device-mapper plug-in up into separate plugins for dm itself and each of the current device-mapper applications: - devicemapper.py - dmraid.py - block.py - lvm2.py - md.py The data collection for each subsystem is largely unchanged other than to fix bugs and remove obsolete items: - support for multipath bindings in /var dropped (only relevant to RHEL5 and earlier) - collect multipath -l separately from -ll - fix 'udevinfo' -> 'udevadm info' Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/block.py34
-rw-r--r--sos/plugins/devicemapper.py48
-rw-r--r--sos/plugins/dmraid.py26
-rw-r--r--sos/plugins/lvm2.py49
-rw-r--r--sos/plugins/md.py29
-rw-r--r--sos/plugins/multipath.py30
6 files changed, 171 insertions, 45 deletions
diff --git a/sos/plugins/block.py b/sos/plugins/block.py
new file mode 100644
index 00000000..270080a9
--- /dev/null
+++ b/sos/plugins/block.py
@@ -0,0 +1,34 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+
+class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """Block device related information
+ """
+
+ def setup(self):
+ # 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("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))
+
diff --git a/sos/plugins/devicemapper.py b/sos/plugins/devicemapper.py
index 5a3e027c..6e2b1a52 100644
--- a/sos/plugins/devicemapper.py
+++ b/sos/plugins/devicemapper.py
@@ -13,57 +13,15 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
-from sos.plugins import Plugin, RedHatPlugin
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class devicemapper(Plugin, RedHatPlugin):
- """device-mapper related information (dm, lvm, multipath)
+class DeviceMapper(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """device-mapper related information
"""
- option_list = [("lvmdump", 'collect raw metadata from PVs', 'slow', False),
- ("lvmdump-a", 'use the -a option of lvmdump (requires the "lvmdump" option)', 'slow', False)]
- dmraid_options = ['V','b','r','s','tay','rD']
-
- def do_lvmdump(self):
- """Collects raw metadata directly from the PVs using dd
- """
- cmd = "lvmdump -d '%s'" % os.path.join(self.commons['dstroot'],"lvmdump")
- if self.get_option('lvmdump-a'):
- cmd += " -a"
- self.add_cmd_output(cmd)
-
def setup(self):
self.add_cmd_output("dmsetup info -c")
self.add_cmd_output("dmsetup table")
self.add_cmd_output("dmsetup status")
self.add_cmd_output("dmsetup ls --tree")
- self.add_cmd_output("vgdisplay -vv", root_symlink = "vgdisplay")
- self.add_cmd_output("vgscan -vvv")
- self.add_cmd_output("pvscan -v")
- self.add_cmd_output("lvs -a -o +devices")
- self.add_cmd_output("pvs -a -v")
- self.add_cmd_output("vgs -v")
- self.add_cmd_output("mdadm -D /dev/md*")
-
- self.add_copy_specs([
- "/etc/lvm",
- "/etc/multipath/",
- "/etc/multipath.conf",
- "/var/lib/multipath/bindings"])
- self.add_cmd_output("multipath -v4 -ll")
-
- self.add_cmd_output("systool -v -c -b scsi")
-
- self.add_cmd_output("ls -lanR /dev")
- self.add_cmd_output("ls -lanR /sys/block")
-
- if self.get_option('lvmdump'):
- self.do_lvmdump()
-
- 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("udevinfo -ap /sys/block/%s" % (disk))
- for opt in self.dmraid_options:
- self.add_cmd_output("dmraid -%s" % (opt,))
diff --git a/sos/plugins/dmraid.py b/sos/plugins/dmraid.py
new file mode 100644
index 00000000..6c99d746
--- /dev/null
+++ b/sos/plugins/dmraid.py
@@ -0,0 +1,26 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+
+class DmRaid(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """dmraid related information
+ """
+
+ dmraid_options = ['V','b','r','s','tay','rD']
+
+ def setup(self):
+ for opt in self.dmraid_options:
+ self.add_cmd_output("dmraid -%s" % (opt,))
diff --git a/sos/plugins/lvm2.py b/sos/plugins/lvm2.py
new file mode 100644
index 00000000..f34cd5fb
--- /dev/null
+++ b/sos/plugins/lvm2.py
@@ -0,0 +1,49 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+
+class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """lvm2 related information
+ """
+
+ option_list = [("lvmdump", 'collect an lvmdump tarball', 'fast', False),
+ ("lvmdump-a", 'use the -a option of lvmdump (implies the ' \
+ + '"lvmdump" option)', 'slow', False)]
+
+ def do_lvmdump(self):
+ """Collects an lvmdump in standard format with optional metadata
+ archives for each physical volume present.
+ """
+ cmd = "lvmdump -d '%s'" % os.path.join(self.commons['dstroot'],
+ "lvmdump")
+ if self.get_option('lvmdump-a'):
+ cmd += " -a"
+ self.add_cmd_output(cmd)
+
+ def setup(self):
+ self.add_cmd_output("vgdisplay -vv", root_symlink = "vgdisplay")
+ self.add_cmd_output("vgscan -vvv")
+ self.add_cmd_output("pvscan -v")
+ self.add_cmd_output("pvs -a -v")
+ self.add_cmd_output("vgs -v")
+ self.add_cmd_output("lvs -a -o +devices")
+
+ self.add_copy_spec("/etc/lvm")
+
+ if self.get_option('lvmdump'):
+ self.do_lvmdump()
+
+
diff --git a/sos/plugins/md.py b/sos/plugins/md.py
new file mode 100644
index 00000000..752a52a1
--- /dev/null
+++ b/sos/plugins/md.py
@@ -0,0 +1,29 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+
+class Md(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """MD subsystem information
+ """
+
+ def setup(self):
+ self.add_cmd_output("mdadm -D /dev/md*")
+ self.add_copy_specs([
+ "/proc/mdstat",
+ "/etc/mdadm.conf",
+ "/dev/md/md-device-map"
+ ])
+
diff --git a/sos/plugins/multipath.py b/sos/plugins/multipath.py
new file mode 100644
index 00000000..3fa2c33b
--- /dev/null
+++ b/sos/plugins/multipath.py
@@ -0,0 +1,30 @@
+### This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import os
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+
+class Multipath(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+ """device-mapper multipath information
+ """
+
+ def setup(self):
+ self.add_copy_specs([
+ "/etc/multipath/",
+ "/etc/multipath.conf"
+ ])
+ self.add_cmd_output("multipath -l")
+ self.add_cmd_output("multipath -v4 -ll")
+
+