aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-15 21:26:54 +0000
committerpcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-11-15 21:26:54 +0000
commitee12f8efc515c288f78dbc737267d562b26dbe94 (patch)
treed81ec8e96b2b0283eb18923c486f22e1bbabc8e5
parent1658251cadd38cecd8b50ce1560d6d52038053b7 (diff)
downloadsos-ee12f8efc515c288f78dbc737267d562b26dbe94.tar.gz
filesys.py supports systems without /sbin/hdparm
s390(x) does not have hdparm. Closes RHBZ#653498. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@1001 ef72aa8b-4018-0410-8976-d6e080ef94d8
-rw-r--r--sos/plugins/filesys.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py
index 28007e1c..93568361 100644
--- a/sos/plugins/filesys.py
+++ b/sos/plugins/filesys.py
@@ -49,12 +49,22 @@ class filesys(sos.plugintools.PluginBase):
partlist.append('/dev/' + line.split()[-1])
except IOError:
exit(1)
- for dev in partlist:
- ret, hdparm, time = self.callExtProg('/sbin/hdparm -g %s' %(dev))
- if(ret == 0):
- start_geo = hdparm.strip().split("\n")[-1].strip().split()[-1]
- if(start_geo == "0"):
+ if os.path.exists("/sbin/hdparm"):
+ for dev in partlist:
+ ret, hdparm, time = self.callExtProg('/sbin/hdparm -g %s' %(dev))
+ if(ret == 0):
+ start_geo = hdparm.strip().split("\n")[-1].strip().split()[-1]
+ if(start_geo == "0"):
+ devlist.append(dev)
+ # RHEL* does not ship hdparm for S390(x)
+ # Cheaper heuristic handling at least dm-.* correctly
+ else:
+ part_in_disk = re.compile("/dev/[a-z]+[0-9]+$")
+ for dev in partlist:
+ print part_in_disk.match(dev)
+ if not bool(part_in_disk.match(dev)):
devlist.append(dev)
+
for i in devlist:
self.collectExtOutput("/sbin/parted -s %s print" % (i))