mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-27 07:44:01 +02:00
Very minor bugfixes (Rev 1.25)
This commit is contained in:
parent
f06c999d85
commit
adbb15607b
@ -1,16 +1,16 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.24 2015/03/28 00:16:45 root Exp $
|
# $Id: megaclisas-status,v 1.25 2015/03/28 02:25:53 root Exp $
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import pdb
|
import pdb
|
||||||
|
|
||||||
|
#megaclipath = "/opt/MegaRAID/MegaCli/MegaCli64"
|
||||||
|
|
||||||
# Sane defaults
|
# Sane defaults
|
||||||
tabwdth = 4
|
tabwdth = 4
|
||||||
|
|
||||||
#megaclipath = "/opt/MegaRAID/MegaCli/MegaCli64"
|
|
||||||
|
|
||||||
def is_exe(fpath):
|
def is_exe(fpath):
|
||||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
@ -135,6 +135,7 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
size = ''
|
size = ''
|
||||||
state = ''
|
state = ''
|
||||||
strpsz = ''
|
strpsz = ''
|
||||||
|
properties = ''
|
||||||
for line in output:
|
for line in output:
|
||||||
if re.match(r'^RAID Level.*?:.*$',line.strip()):
|
if re.match(r'^RAID Level.*?:.*$',line.strip()):
|
||||||
type = 'RAID-'+line.strip().split(':')[1].split(',')[0].split('-')[1].strip()
|
type = 'RAID-'+line.strip().split(':')[1].split(',')[0].split('-')[1].strip()
|
||||||
@ -156,6 +157,16 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
state = line.strip().split(':')[1].strip()
|
state = line.strip().split(':')[1].strip()
|
||||||
if re.match(r'^Strip Size.*?:.*$',line.strip()):
|
if re.match(r'^Strip Size.*?:.*$',line.strip()):
|
||||||
strpsz = line.strip().split(':')[1].strip()
|
strpsz = line.strip().split(':')[1].strip()
|
||||||
|
if re.match(r'^Current Cache Policy.*?:.*$',line.strip()):
|
||||||
|
props = line.strip().split(':')[1].strip()
|
||||||
|
if re.search('WriteBack', props):
|
||||||
|
properties += 'WB'
|
||||||
|
if re.match('WriteThrough', props):
|
||||||
|
properties += 'WT'
|
||||||
|
if re.search('ReadAdaptive', props):
|
||||||
|
properties += ',RA'
|
||||||
|
if re.match('ReadAheadNone', props):
|
||||||
|
properties += ',NoRA'
|
||||||
if re.match(r'^Ongoing Progresses.*?:.*$',line.strip()):
|
if re.match(r'^Ongoing Progresses.*?:.*$',line.strip()):
|
||||||
operationlinennumber = linenumber
|
operationlinennumber = linenumber
|
||||||
linenumber += 1
|
linenumber += 1
|
||||||
@ -163,7 +174,7 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
inprogress = output[operationlinennumber+1]
|
inprogress = output[operationlinennumber+1]
|
||||||
else:
|
else:
|
||||||
inprogress = 'None'
|
inprogress = 'None'
|
||||||
return [id,type,size,strpsz,state,inprogress]
|
return [id,type,size,strpsz,properties,state,inprogress]
|
||||||
|
|
||||||
def returnDiskInfo(output,controllerid):
|
def returnDiskInfo(output,controllerid):
|
||||||
arrayid = False
|
arrayid = False
|
||||||
@ -335,10 +346,11 @@ if printcontroller:
|
|||||||
|
|
||||||
if printarray:
|
if printarray:
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
|
|
||||||
print '-- Array information --'
|
print '-- Array information --'
|
||||||
|
|
||||||
ldfmt = "%-5s | %-6s | %-7s | %-6s | %-8s | %-12s "
|
ldfmt = str('%-5s | %-6s | %7s | %7s | %7s | %8s | %-12s ')
|
||||||
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Status", "InProgress" )
|
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "Status", "InProgress" )
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
arrayid = 0
|
arrayid = 0
|
||||||
cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid)
|
cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid)
|
||||||
@ -354,8 +366,9 @@ if printarray:
|
|||||||
arrayinfo[2],
|
arrayinfo[2],
|
||||||
arrayinfo[3],
|
arrayinfo[3],
|
||||||
arrayinfo[4],
|
arrayinfo[4],
|
||||||
arrayinfo[5])
|
arrayinfo[5],
|
||||||
if not arrayinfo[4] == 'Optimal':
|
arrayinfo[6])
|
||||||
|
if not arrayinfo[5] == 'Optimal':
|
||||||
bad = True
|
bad = True
|
||||||
arrayid += 1
|
arrayid += 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user