mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-26 07:14:25 +02:00
Very minor bugfixes (Rev 1.14)
This commit is contained in:
parent
43655abb1e
commit
e481cb37f4
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.13 2015/01/14 20:33:23 root Exp $
|
# $Id: megaclisas-status,v 1.14 2015/01/14 20:40:09 root Exp $
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -13,6 +13,9 @@ if len(sys.argv) > 2:
|
|||||||
printarray = True
|
printarray = True
|
||||||
printcontroller = True
|
printcontroller = True
|
||||||
totaldrivenumber = 0
|
totaldrivenumber = 0
|
||||||
|
totalunconfdrivenumber = 0
|
||||||
|
|
||||||
|
#### pdb.set_trace()
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == '-d':
|
if sys.argv[1] == '-d':
|
||||||
@ -20,7 +23,7 @@ if len(sys.argv) > 1:
|
|||||||
printcontroller = False
|
printcontroller = False
|
||||||
else:
|
else:
|
||||||
print 'Usage: megaraid-status [-d]'
|
print 'Usage: megaraid-status [-d]'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Get command output
|
# Get command output
|
||||||
def getOutput(cmd):
|
def getOutput(cmd):
|
||||||
@ -42,13 +45,12 @@ def returnTotalDriveNumber(output):
|
|||||||
return int(line.split(':')[1].strip())
|
return int(line.split(':')[1].strip())
|
||||||
|
|
||||||
def returnUnconfDriveNumber(output):
|
def returnUnconfDriveNumber(output):
|
||||||
configdrives = 0
|
confdrives = 0
|
||||||
unconfdrives = 0
|
unconfdrives = 0
|
||||||
for line in output:
|
for line in output:
|
||||||
if re.match(r'.*Number of PDs:.*$',line.strip()):
|
if re.match(r'.*Number of PDs:.*$',line.strip()):
|
||||||
configdrives += int(line.split(':')[2].strip())
|
confdrives += int(line.split(':')[2].strip())
|
||||||
#### pdb.set_trace()
|
unconfdrives = totaldrivenumber - confdrives
|
||||||
unconfdrives = totaldrivenumber - configdrives
|
|
||||||
return int(unconfdrives)
|
return int(unconfdrives)
|
||||||
|
|
||||||
def returnControllerModel(output):
|
def returnControllerModel(output):
|
||||||
@ -248,6 +250,7 @@ if printarray:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
cmd = 'megacli -PDGetNum -a'+str(controllerid)+' -NoLog'
|
cmd = 'megacli -PDGetNum -a'+str(controllerid)+' -NoLog'
|
||||||
@ -275,7 +278,6 @@ if totaldrivenumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
totalunconfdrivenumber = 0
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
cmd = 'megacli -LdPdInfo -a'+str(controllerid)+' -NoLog'
|
cmd = 'megacli -LdPdInfo -a'+str(controllerid)+' -NoLog'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user