From eb70cb0e83618bd2000c5481b8b39397b9abba14 Mon Sep 17 00:00:00 2001 From: astokes Date: Fri, 13 Mar 2009 17:59:17 +0000 Subject: resolves: rhbz490186 git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@553 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/lib/sos/plugins/ds.py | 15 ++++++++++----- src/lib/sos/plugins/filesys.py | 21 ++++++++++++++++++++- src/lib/sos/plugins/kernel.py | 1 - src/lib/sos/plugins/xen.py | 3 ++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/lib/sos/plugins/ds.py b/src/lib/sos/plugins/ds.py index f80c7fe5..2c24beeb 100644 --- a/src/lib/sos/plugins/ds.py +++ b/src/lib/sos/plugins/ds.py @@ -21,24 +21,29 @@ class ds(sos.plugintools.PluginBase): """Directory Server information """ - ds_version = None + def check_version(self): + if self.cInfo["policy"].pkgByName("redhat-ds-base") or \ + os.path.exists("/etc/dirsrv"): + return "ds8" + elif self.cInfo["policy"].pkgByName("redhat-ds-7") or \ + os.path.exists("/opt/redhat-ds"): + return "ds7" + return False def checkenabled(self): if self.cInfo["policy"].pkgByName("redhat-ds-base") or \ os.path.exists("/etc/dirsrv"): - self.ds_version = "ds8" return True elif self.cInfo["policy"].pkgByName("redhat-ds-7") or \ os.path.exists("/opt/redhat-ds"): - self.ds_version = "ds7" return True return False def setup(self): - if "ds8" in self.ds_version: + if "ds8" in self.check_version(): self.addCopySpec("/etc/dirsrv/slapd*") self.addCopySpec("/var/log/dirsrv/*") - if "ds7" in self.ds_version: + if "ds7" in self.check_version(): self.addCopySpec("/opt/redhat-ds/slapd-*/config") self.addCopySpec("/opt/redhat-ds/slapd-*/logs") return diff --git a/src/lib/sos/plugins/filesys.py b/src/lib/sos/plugins/filesys.py index 111ef2fc..1ff0c712 100644 --- a/src/lib/sos/plugins/filesys.py +++ b/src/lib/sos/plugins/filesys.py @@ -14,6 +14,7 @@ import sos.plugintools import os +import re class filesys(sos.plugintools.PluginBase): """information on filesystems @@ -32,7 +33,25 @@ class filesys(sos.plugintools.PluginBase): self.collectExtOutput("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof") self.collectExtOutput("/sbin/blkid") - self.collectExtOutput("/sbin/fdisk -l", root_symlink = "fdisk-l") + 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) + for dev in partlist: + hdparm = commands.getstatusoutput('/sbin/hdparm -g %s' %(dev)) + if(hdparm[0] == 0): + start_geo = hdparm[1].strip().split("\n")[-1].strip().split()[-1] + if(start_geo == "0"): + devlist.append(dev) + for i in devlist: + self.collectExtOutput("/sbin/parted -s %s print" % (i)) for extfs in self.doRegexFindAll(r"^(/dev/.+) on .+ type ext.\s+", mounts): self.collectExtOutput("/sbin/dumpe2fs %s" % (extfs)) diff --git a/src/lib/sos/plugins/kernel.py b/src/lib/sos/plugins/kernel.py index 32ec59ce..604d42f2 100644 --- a/src/lib/sos/plugins/kernel.py +++ b/src/lib/sos/plugins/kernel.py @@ -44,7 +44,6 @@ class kernel(sos.plugintools.PluginBase): # # - def setup(self): self.collectExtOutput("/bin/uname -a", root_symlink = "uname") self.moduleFile = self.collectOutputNow("/sbin/lsmod", root_symlink = "lsmod") diff --git a/src/lib/sos/plugins/xen.py b/src/lib/sos/plugins/xen.py index 66198a0a..4126f720 100644 --- a/src/lib/sos/plugins/xen.py +++ b/src/lib/sos/plugins/xen.py @@ -14,6 +14,7 @@ import sos.plugintools import os, commands +import re from stat import * class xen(sos.plugintools.PluginBase): @@ -78,7 +79,7 @@ class xen(sos.plugintools.PluginBase): self.addCopySpec("/sys/hypervisor/compilation") self.addCopySpec("/sys/hypervisor/properties") self.addCopySpec("/sys/hypervisor/type") - if is_xenstored_running(): + if self.is_running_xenstored(): self.addCopySpec("/sys/hypervisor/uuid") self.collectExtOutput("/usr/bin/xenstore-ls") else: -- cgit