diff --git a/wrapper-scripts/megaclisas-status b/wrapper-scripts/megaclisas-status index 3a0d45d..5fcf4fc 100755 --- a/wrapper-scripts/megaclisas-status +++ b/wrapper-scripts/megaclisas-status @@ -1,5 +1,5 @@ #!/usr/bin/python -# $Id: megaclisas-status,v 1.47 2015/04/17 02:58:20 root Exp $ +# $Id: megaclisas-status,v 1.48 2015/04/17 14:08:43 root Exp $ # # Written by Adam Cecile # Modified vy Vincent S. Cojot @@ -178,7 +178,7 @@ def returnArrayNumber(output): i += 1 return i -def returnPCIInfo(output): +def returnHBAPCIInfo(output): busprefix = '0000' busid = '' devid = '' @@ -191,9 +191,12 @@ def returnPCIInfo(output): devid = str(line.strip().split(':')[1].strip()).zfill(2) if re.match(r'^Function Number.*:.*$',line.strip()): functionid = str(line.strip().split(':')[1].strip()).zfill(1) - pcipath = str(busprefix + ':' + busid + ':' + devid + '.' + functionid) - dbgprint("Array PCI path : "+pcipath) - return str(pcipath) + if busid: + pcipath = str(busprefix + ':' + busid + ':' + devid + '.' + functionid) + dbgprint("Array PCI path : "+pcipath) + return str(pcipath) + else: + return None def returnHBAInfo(table,output,controllerid): controllermodel = 'Unknown' @@ -507,7 +510,7 @@ if printarray: cmd = '%s -AdpGetPciInfo -a%d -NoLog' % (megaclipath, controllerid) output = getOutput(cmd) - pcipath = returnPCIInfo(output) + pcipath = returnHBAPCIInfo(output) cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid) output = getOutput(cmd) @@ -518,11 +521,14 @@ if printarray: output = getOutput(cmd) arrayinfo = returnArrayInfo(output,controllerid, ldid) - diskprefix = str('/dev/disk/by-path/pci-' + pcipath + '-scsi-0:') - for j in range (8): - diskpath = diskprefix + str(j) + ':' + str(arrayinfo[7]) + ':0' - if os.path.exists(diskpath): - arrayinfo[7] = os.path.realpath(diskpath) + if pcipath: + diskprefix = str('/dev/disk/by-path/pci-' + pcipath + '-scsi-0:') + for j in range (8): + diskpath = diskprefix + str(j) + ':' + str(arrayinfo[7]) + ':0' + if os.path.exists(diskpath): + arrayinfo[7] = os.path.realpath(diskpath) + else: + arrayinfo[7] = 'N/A' ldfmt = str('%-5s | %-'+str(rlen)+'s | %7s | %7s | %'+str(mlen)+'s | %8s | %7s | %8s | %-12s ') # Header