Very minor bugfixes (Rev 1.23)

This commit is contained in:
Vincent S. Cojot 2015-03-28 00:11:19 -04:00
parent d37cb2451b
commit 0bec893d24

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
# $Id: megaclisas-status,v 1.22 2015/03/27 13:27:18 root Exp $
# $Id: megaclisas-status,v 1.23 2015/03/28 00:11:19 root Exp $
import os
import re
@ -134,6 +134,7 @@ def returnArrayInfo(output,controllerid,arrayid):
type = ''
size = ''
state = ''
strpsz = ''
for line in output:
if re.match(r'^RAID Level.*?:.*$',line.strip()):
type = 'RAID-'+line.strip().split(':')[1].split(',')[0].split('-')[1].strip()
@ -153,6 +154,8 @@ def returnArrayInfo(output,controllerid,arrayid):
size = str(int(round((float(size)))))+'G'
if re.match(r'^State.*?:.*$',line.strip()):
state = line.strip().split(':')[1].strip()
if re.match(r'^Strip Size.*?:.*$',line.strip()):
strpsz = line.strip().split(':')[1].strip()
if re.match(r'^Ongoing Progresses.*?:.*$',line.strip()):
operationlinennumber = linenumber
linenumber += 1
@ -160,7 +163,7 @@ def returnArrayInfo(output,controllerid,arrayid):
inprogress = output[operationlinennumber+1]
else:
inprogress = 'None'
return [id,type,size,state,inprogress]
return [id,type,size,strpsz,state,inprogress]
def returnDiskInfo(output,controllerid):
arrayid = False
@ -328,8 +331,10 @@ if printcontroller:
if printarray:
controllerid = 0
print '-- Arrays information --'
print '-- ID\t| Type | Size | Status | InProgress'
print '-- Array information --'
ldfmt = "%-5s | %-6s | %-7s | %-6s | %-8s | %-12s "
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Status", "InProgress" )
while controllerid < controllernumber:
arrayid = 0
cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid)
@ -339,8 +344,14 @@ if printarray:
cmd = '%s -LDInfo -l%d -a%d -NoLog' % (megaclipath, arrayid, controllerid)
output = getOutput(cmd)
arrayinfo = returnArrayInfo(output,controllerid,arrayid)
print arrayinfo[0]+'\t| '+arrayinfo[1]+' | '+arrayinfo[2]+' | '+arrayinfo[3]+' | '+arrayinfo[4]
if not arrayinfo[3] == 'Optimal':
print ldfmt % (
arrayinfo[0],
arrayinfo[1],
arrayinfo[2],
arrayinfo[3],
arrayinfo[4],
arrayinfo[5])
if not arrayinfo[4] == 'Optimal':
bad = True
arrayid += 1
controllerid += 1
@ -355,7 +366,7 @@ while controllerid < controllernumber:
controllerid += 1
if totaldrivenumber:
print '-- Disks information --'
print '-- Disk information --'
# print '-- ID\t| Type\t| Model\t\t\t\t\t| Size\t\t| Status\t\t| Speed\t\t| Temp\t| Slot ID\t| LSI Device ID '.expandtabs(tabwdth)
controllerid = 0
@ -407,7 +418,7 @@ while controllerid < controllernumber:
controllerid += 1
if totalunconfdrivenumber:
print '-- Unconfigured Disks information --'
print '-- Unconfigured Disk information --'
controllerid = 0
while controllerid < controllernumber: