dstat_md_status.py (dstat-0.7.3) | : | dstat_md_status.py (dstat-0.7.4) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
self.name = 'sw raid' | self.name = 'sw raid' | |||
self.type = 's' | self.type = 's' | |||
self.scale = 0 | self.scale = 0 | |||
self.nick = ('pct speed', ) | self.nick = ('pct speed', ) | |||
self.width = 9 | self.width = 9 | |||
self.vars = ('text', ) | self.vars = ('text', ) | |||
self.open('/proc/mdstat') | self.open('/proc/mdstat') | |||
def check(self): | def check(self): | |||
if not os.path.exists('/proc/mdstat'): | if not os.path.exists('/proc/mdstat'): | |||
raise Exception, 'Needs kernel md support' | raise Exception('Needs kernel md support') | |||
def extract(self): | def extract(self): | |||
pct = 0 | pct = 0 | |||
speed = 0 | speed = 0 | |||
nr = 0 | nr = 0 | |||
for l in self.splitlines(): | for l in self.splitlines(): | |||
if len(l) < 2: continue | if len(l) < 2: continue | |||
if l[1] in ('recovery', 'reshape', 'resync'): | if l[1] in ('recovery', 'reshape', 'resync'): | |||
nr += 1 | nr += 1 | |||
pct += int(l[3][0:2].strip('.%')) | pct += int(l[3][0:2].strip('.%')) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |