verify that array exists on controller

This commit is contained in:
Joe Hofeditz 2014-10-16 06:30:02 -07:00
parent daad522781
commit 3a03488f87
1 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import os
import re import re
import sys import sys
binarypath = "/usr/sbin/sas2ircu" binarypath = "/sbin/sas2ircu"
if len(sys.argv) > 2: if len(sys.argv) > 2:
print 'Usage: sas2ircu-status [--nagios]' print 'Usage: sas2ircu-status [--nagios]'
@ -42,12 +42,18 @@ def getCtrlList():
for line in res: for line in res:
if re.match('^[0-9]+.*$',line): if re.match('^[0-9]+.*$',line):
ctrlnmbr,ctrlname=int(line.split()[0]),line.split()[1] ctrlnmbr,ctrlname=int(line.split()[0]),line.split()[1]
# Check if it's a RAID controller # Check if it's a RAID controller and a volume exists
cmd=binarypath+' '+str(ctrlnmbr)+' DISPLAY' cmd=binarypath+' '+str(ctrlnmbr)+' DISPLAY'
res=getOutput(cmd) res=getOutput(cmd)
raid=False
validarray=False
for line in res: for line in res:
if re.match('^RAID Support\s+:\s+Yes$',line): if re.match('^RAID Support\s+:\s+Yes$',line):
list.append([ctrlnmbr,ctrlname]) raid=True
if re.match('^IR volume [0-9]+.*$',line):
validarray=True
if raid and validarray:
list.append([ctrlnmbr,ctrlname])
# ie: [['0', 'SAS2008']] # ie: [['0', 'SAS2008']]
return list return list