[megaclisas-status] Do not use un-initialized arrays

This commit is contained in:
Vincent S. Cojot 2016-03-09 08:50:01 -05:00
parent 34abdc9132
commit 2561f0cb8d

View File

@ -28,7 +28,8 @@ totaldrivenumber = 0
# Hardcode a max of 16 HBA for now. LDTable must be initialized to accept populating list of LD's into each ctlr's list. # Hardcode a max of 16 HBA for now. LDTable must be initialized to accept populating list of LD's into each ctlr's list.
LDTable = [ [] * 16 for i in range(16) ] LDTable = [ [] * 16 for i in range(16) ]
NestedLDTable = [ [] * 16 for i in range(16) ] NestedLDTable = [[False for i in range(16)] for j in range(16)]
# Outputs is a 'dict' of all MegaCLI outputs so we can re-use them during loops.. # Outputs is a 'dict' of all MegaCLI outputs so we can re-use them during loops..
Outputs = {} Outputs = {}
@ -344,6 +345,7 @@ def returnArrayInfo(output,controllerid,arrayid,arrayindex):
inprogress = 'None' inprogress = 'None'
# Compute the RAID level # Compute the RAID level
NestedLDTable[int(controllerid)][int(arrayindex)] = False
if (int(spandepth) >= 2): if (int(spandepth) >= 2):
raidtype = str('RAID-' + str(raidlvl) + '0') raidtype = str('RAID-' + str(raidlvl) + '0')
NestedLDTable[controllerid][int(arrayindex)] = True NestedLDTable[controllerid][int(arrayindex)] = True
@ -595,7 +597,7 @@ if printarray:
ldid += 1 ldid += 1
elif re.match(r'^(CacheCade )?Virtual Drive:',line.strip()): elif re.match(r'^(CacheCade )?Virtual Drive:',line.strip()):
LDTable[controllerid].append ( ldid ) LDTable[controllerid].append ( ldid )
NestedLDTable[controllerid][int(arrayindex)] = False #NestedLDTable[controllerid][int(arrayindex)] = False
ldcount += 1 ldcount += 1
ldid += 1 ldid += 1