mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-26 07:14:25 +02:00
Very minor bugfixes (Rev 1.23)
This commit is contained in:
parent
d37cb2451b
commit
0bec893d24
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/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 os
|
||||||
import re
|
import re
|
||||||
@ -134,6 +134,7 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
type = ''
|
type = ''
|
||||||
size = ''
|
size = ''
|
||||||
state = ''
|
state = ''
|
||||||
|
strpsz = ''
|
||||||
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()
|
||||||
@ -153,6 +154,8 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
size = str(int(round((float(size)))))+'G'
|
size = str(int(round((float(size)))))+'G'
|
||||||
if re.match(r'^State.*?:.*$',line.strip()):
|
if re.match(r'^State.*?:.*$',line.strip()):
|
||||||
state = line.strip().split(':')[1].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()):
|
if re.match(r'^Ongoing Progresses.*?:.*$',line.strip()):
|
||||||
operationlinennumber = linenumber
|
operationlinennumber = linenumber
|
||||||
linenumber += 1
|
linenumber += 1
|
||||||
@ -160,7 +163,7 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
inprogress = output[operationlinennumber+1]
|
inprogress = output[operationlinennumber+1]
|
||||||
else:
|
else:
|
||||||
inprogress = 'None'
|
inprogress = 'None'
|
||||||
return [id,type,size,state,inprogress]
|
return [id,type,size,strpsz,state,inprogress]
|
||||||
|
|
||||||
def returnDiskInfo(output,controllerid):
|
def returnDiskInfo(output,controllerid):
|
||||||
arrayid = False
|
arrayid = False
|
||||||
@ -328,8 +331,10 @@ if printcontroller:
|
|||||||
|
|
||||||
if printarray:
|
if printarray:
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
print '-- Arrays information --'
|
print '-- Array information --'
|
||||||
print '-- ID\t| Type | Size | Status | InProgress'
|
|
||||||
|
ldfmt = "%-5s | %-6s | %-7s | %-6s | %-8s | %-12s "
|
||||||
|
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "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)
|
||||||
@ -339,8 +344,14 @@ if printarray:
|
|||||||
cmd = '%s -LDInfo -l%d -a%d -NoLog' % (megaclipath, arrayid, controllerid)
|
cmd = '%s -LDInfo -l%d -a%d -NoLog' % (megaclipath, arrayid, controllerid)
|
||||||
output = getOutput(cmd)
|
output = getOutput(cmd)
|
||||||
arrayinfo = returnArrayInfo(output,controllerid,arrayid)
|
arrayinfo = returnArrayInfo(output,controllerid,arrayid)
|
||||||
print arrayinfo[0]+'\t| '+arrayinfo[1]+' | '+arrayinfo[2]+' | '+arrayinfo[3]+' | '+arrayinfo[4]
|
print ldfmt % (
|
||||||
if not arrayinfo[3] == 'Optimal':
|
arrayinfo[0],
|
||||||
|
arrayinfo[1],
|
||||||
|
arrayinfo[2],
|
||||||
|
arrayinfo[3],
|
||||||
|
arrayinfo[4],
|
||||||
|
arrayinfo[5])
|
||||||
|
if not arrayinfo[4] == 'Optimal':
|
||||||
bad = True
|
bad = True
|
||||||
arrayid += 1
|
arrayid += 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
@ -355,7 +366,7 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totaldrivenumber:
|
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)
|
# 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
|
controllerid = 0
|
||||||
@ -407,7 +418,7 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totalunconfdrivenumber:
|
if totalunconfdrivenumber:
|
||||||
print '-- Unconfigured Disks information --'
|
print '-- Unconfigured Disk information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user