diff options
author | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-06 09:01:48 +0000 |
---|---|---|
committer | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-12-06 09:01:48 +0000 |
commit | 4c38c7a9021b0ca90446f818910502d69c898ebc (patch) | |
tree | 41a2c3e94e2922d427d46f0c6e3e2ae95958dee9 | |
parent | f58fd94fb492175c4334ecd8fbc0a9a5aa3abc4b (diff) | |
download | sos-4c38c7a9021b0ca90446f818910502d69c898ebc.tar.gz |
hopefully fixed kernel packages detection code
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@462 ef72aa8b-4018-0410-8976-d6e080ef94d8
-rw-r--r-- | src/lib/sos/plugins/cluster.py | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/src/lib/sos/plugins/cluster.py b/src/lib/sos/plugins/cluster.py index b536512d..ff2a233c 100644 --- a/src/lib/sos/plugins/cluster.py +++ b/src/lib/sos/plugins/cluster.py @@ -51,15 +51,11 @@ class cluster(sos.plugintools.PluginBase): # for RHEL4 RHCS(ccs, cman, cman-kernel, magma, magma-plugins, (dlm, dlm-kernel) || gulm, perl-Net-Telnet, rgmanager, fence) # RHEL4 GFS (GFS, GFS-kernel, ccs, lvm2-cluster, fence) - kernel_pkgs = [] pkgs_check = [] mods_check = [] serv_check = [] if rhelver == 4: - kernel_pkgs = [ "dlm-kernel" , "cman-kernel" ] - if self.has_gfs(): - kernel_pkgs.append("GFS-kernel") pkgs_check.extend( [ "ccs", "cman", "magma", "magma-plugins", "perl-Net-Telnet", "rgmanager", "fence" ] ) mods_check.extend( [ "cman", "dlm" ] ) if self.has_gfs(): @@ -68,8 +64,6 @@ class cluster(sos.plugintools.PluginBase): if self.has_gfs(): serv_check.extend( ["gfs", "clvmd"] ) elif rhelver == 5: - if self.has_gfs(): - kernel_pkgs.append("kmod-gfs") pkgs_check.extend ( [ "cman", "perl-Net-Telnet", "rgmanager" ] ) mods_check.extend( [ "dlm" ] ) if self.has_gfs(): @@ -81,27 +75,26 @@ class cluster(sos.plugintools.PluginBase): # check that kernel module packages are installed for # running kernel version - for pkgname in kernel_pkgs: + for modname in mods_check: found = 0 - # FIXME: make sure it works on RHEL4 - for pkg in self.cInfo["policy"].allPkgsByNameRegex( "^" + pkgname ): - found = 1 - for reqline in pkg.dsFromHeader('requirename'): - reqline = reqline[0].split() - try: - if reqline[1].startswith("kernel") and reqline[2] == "=" and reqline[3] == self.cInfo["policy"].kernelVersion(): - found = 2 - break - except IndexError: - pass - if found == 2: - break + if self.cInfo["policy"].allPkgsByNameRegex( "^" + modname ): + found = 1 + + status, output = commands.getstatusoutput('/sbin/modinfo -F vermagic ' + modname) + + if status == 0: + found = 2 + + if len(self.fileGrep("^%s\s+" % modname, "/proc/modules")) > 0: + found = 3 if found == 0: - self.addDiagnose("required kernel package is missing: %s" % pkgname) + self.addDiagnose("required kernel module is missing: %s" % modname) elif found == 1: - self.addDiagnose("required package is not installed for current kernel: %s" % pkgname) + self.addDiagnose("required module is not available for current kernel: %s" % modname) + elif found == 2: + self.addDiagnose("required module is available but not loaded: %s" % module) for pkg in pkgs_check: if self.cInfo["policy"].pkgByName(pkg) == None: @@ -112,10 +105,6 @@ class cluster(sos.plugintools.PluginBase): if not ((self.cInfo["policy"].pkgByName("dlm") and self.cInfo["policy"].pkgByName("dlm-kernel")) or self.cInfo["policy"].pkgByName("gulm")): self.addDiagnose("required packages are missing: (dlm, dlm-kernel) || gulm") - for module in mods_check: - if len(self.fileGrep("^%s\s+" % module, "/proc/modules")) == 0: - self.addDiagnose("required module is not loaded: %s" % module) - # check if all the needed daemons are active at sosreport time # check if they are started at boot time in RHEL4 RHCS (cman, ccsd, rgmanager, fenced) # and GFS (gfs, ccsd, clvmd, fenced) |