-
Notifications
You must be signed in to change notification settings - Fork 0
/
lsslot_vd
executable file
·731 lines (480 loc) · 19.7 KB
/
lsslot_vd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
#!/usr/bin/env python3
"""
lsslot - Mathew Binkley
Display a table showing which hard drive is in each slot on a depot.
"""
import re
import time
import socket
import os
#import os
#import stat
from subprocess import Popen, PIPE, STDOUT
from prettytable import PrettyTable
# Cache info
CacheDataArray = {}
CacheTimeArray = {}
# Array to hold the output for pretty printing
Output = []
# Enable/disable debugging messages
Print_Debug = False
def Debug(text):
"""
A wrapper to print debugging info on a single line.
"""
if Print_Debug:
print("DEBUG: " + text)
return
def SysExec(cmd):
"""
Run the given command and return the output
"""
# Cache the output of the command for 20 seconds
Cache_Expires = 20
# Computed once, used twice
Cache_Keys = list(CacheDataArray.keys())
if cmd in Cache_Keys:
Cache_Age = time.time() - CacheTimeArray[cmd]
else:
Cache_Age = 0
Return_Val = "ERROR"
# If we have valid data cached, return it
if cmd in Cache_Keys and Cache_Age < Cache_Expires:
Return_Val = CacheDataArray[cmd]
# If the cmd is "cat", use fopen/fread/fclose to open it and
# cache it as we go
elif not cmd in Cache_Keys and cmd.split()[0] == "cat":
f = open(cmd.split()[1], "r")
CacheDataArray[cmd] = f.read()
CacheTimeArray[cmd] = time.time()
f.close()
Return_Val = CacheDataArray[cmd]
# If we don't have cached data, or it's too old, regenerate it
elif not cmd in Cache_Keys or Cache_Age > Cache_Expires:
CacheDataArray[cmd] = Popen(cmd.split(), stdout=PIPE, stderr=STDOUT).communicate()[0]
CacheTimeArray[cmd] = time.time()
Return_Val = CacheDataArray[cmd]
if str(type(Return_Val)) == "<class 'bytes'>":
Return_Val = Return_Val.decode("utf-8")
return(Return_Val)
def List_Enclosures():
"""
List enclosures.
"""
# Our current depots have 24 slots on the Front backplane and 12 on the Rear
# In a more complex setup, we might need a more cumbersome way to alias backplanes
Alias_by_NumSlots = {}
Alias_by_NumSlots["36"] = "Unified"
Alias_by_NumSlots["24"] = "Front"
Alias_by_NumSlots["12"] = "Back"
# Array to hold the output for pretty printing
Output = []
Enclosure_Raw = SysExec("lsscsi -g")
for line in Enclosure_Raw.splitlines():
if not re.search("enclosu", line):
continue
if re.search("VirtualSES", line):
continue
SG_Dev = line.split()[-1]
SG_Bus = line.split()[0]
SG_Bus = re.sub("\[", "", SG_Bus)
SG_Bus = re.sub("\]", "", SG_Bus)
SAS_Addr = "UNKNOWN_SAS"
SAS_Addr_Raw = SysExec("sg_ses --page=aes " + SG_Dev)
for text in SAS_Addr_Raw.splitlines():
if re.search("Primary enclosure logical identifier", text):
SAS_Addr = text.split(":")[1]
SAS_Addr = re.sub(" ", "", SAS_Addr)
Num_Slots = "UNKNOWN_SLOTS"
Num_Slots_Raw = SysExec("sg_ses --page=cf " + SG_Dev)
match = re.search(r'Array device slot(.*)ArrayDevicesInSubEnclsr0', Num_Slots_Raw, re.DOTALL)
match = match.group(0)
for l in match.splitlines():
if re.search("number of possible elements", l):
Num_Slots = l.split(":")[-1]
Num_Slots = re.sub(" ", "", Num_Slots)
Alias = "UNKNOWN_ALIAS"
if Num_Slots in Alias_by_NumSlots:
Alias = Alias_by_NumSlots[Num_Slots]
Output.append([SG_Dev, Num_Slots, SG_Bus, SAS_Addr, Alias])
return(Output)
def FindBackplanes():
"""
Use the "List_Enclosures" function to create a dict about the enclosures in this server
"""
Debug("def FindBackplanes() entry")
enclosures = List_Enclosures()
Backplanes = {}
for i in enclosures:
Backplanes[i[0]] = {}
Backplanes[i[0]]["NumSlots"] = i[1]
Backplanes[i[0]]["Bus"] = i[2]
Backplanes[i[0]]["SASAddr"] = i[3]
Backplanes[i[0]]["Alias"] = i[4]
Debug("def FindBackplanes() exit")
return(Backplanes)
def Get_ChassisBackplane():
"""
Try to guess the backplane model we are dealing with (Chenbro, AIC). I'm not sure if there's
an official way of doing it, so this is just my hacky first stab at it.
Right now I'm only returning a list of detected backplane models, but I may want to add more
in the future, if only I knew what it was...
"""
Debug("def Get_ChassisBackplane() entry")
Backplanes = []
if os.path.isdir("/sys/class/enclosure"):
output_backplanes = SysExec("ls -1 /sys/class/enclosure")
for bus in output_backplanes.splitlines():
Vendor = SysExec("cat /sys/class/enclosure/" + bus + "/device/vendor").strip()
Model = SysExec("cat /sys/class/enclosure/" + bus + "/device/model").strip()
if Vendor == "LSI" and Model == "VirtualSES":
continue
Debug("Get_ChassisBackplane():: Detected backplane " + Vendor + " " + Model)
Backplanes.append(Vendor + " " + Model)
Debug("def Get_ChassisBackplane() entry")
return(Backplanes)
def Get_SASController():
"""
Return the SAS controller model in this depot.
"""
Debug("def Get_SASController() entry")
output_lspci = SysExec("lspci")
# Determine the card type, and thus the path we need to take...
SAS_Controller = "Unknown"
for line in output_lspci.splitlines():
# Falcon is our 1st gen SAS controller
if re.search(r"SAS2008 PCI-Express Fusion-MPT SAS-2 \[Falcon\] \(rev 03\)", line):
SAS_Controller = "LSI_Falcon"
break
# Thunderbolt is our 2nd gen SAS controller
if re.search(r"MegaRAID SAS 2208 \[Thunderbolt\] \(rev 05\)", line):
SAS_Controller = "LSI_Thunderbolt"
break
# Invader is our 3rd gen SAS controller
if re.search(r"MegaRAID SAS-3 3108 \[Invader\] \(rev 02\)", line):
SAS_Controller = "LSI_Invader"
break
# Trimode is our 4th gen SAS controller
if re.search(r"SAS3408 Fusion-MPT Tri-Mode I/O Controller Chip", line):
SAS_Controller = "LSI_FusionMPT"
break
# New depots
if re.search(r"Fusion-MPT 12GSAS/PCIe Secure SAS38xx", line):
SAS_Controller = "LSI_FusionMPT"
break
Debug("Get_SASController():: SAS Controller type = " + SAS_Controller)
if SAS_Controller == "Unknown":
Debug("Get_SASController():: This is an unknown controller type which may not work properly without new code.")
Debug("def Get_SASController() exit")
return(SAS_Controller)
def GetLocateLEDState(This_Backplane, This_Slot):
"""
This function returns the state of the Locate LED on the given backplane/slot
"""
This_LedState = SysExec("sg_ses -I " + str(This_Slot) + " --get=ident " + This_Backplane).strip()
LedState_Descr = "Unknown"
if This_LedState == "1":
LedState_Descr = "On"
if This_LedState == "0":
LedState_Descr = "Off"
return(LedState_Descr)
def map_Dev_to_RID():
"""
Return a map of /dev/ entry -> RID
"""
Debug("def map_Dev_to_RID() entry")
Map = {}
output_ridlist = SysExec("ls -alh /dev/disk/by-label")
for line in output_ridlist.splitlines():
if not re.search("rid-data-", line):
continue
This_Dev = line.split(" ")[-1]
This_Dev = This_Dev.split("/")[2]
This_Dev = re.sub("[0-9]*$", "", This_Dev)
This_Dev = "/dev/" + This_Dev
This_Rid = line.split(" ")[-3]
This_Rid = This_Rid.split("-")[2]
Debug("map_Dev_to_Rid():: Dev " + This_Dev + " = Rid " + This_Rid)
Map[This_Dev] = This_Rid
Debug("def map_Dev_to_RID() exit")
return(Map)
def map_SAS_to_Dev():
"""
Return a map of /dev/ entry -> SAS/GUID/Id/WWN address
"""
Debug("def map_SAS_to_Dev() entry")
Map = {}
output_saslist = SysExec("ls -alh /dev/disk/by-id")
for line in output_saslist.splitlines():
if not re.search("wwn-", line):
continue
if re.search("part", line):
continue
This_Dev = line.split(" ")[-1]
This_Dev = This_Dev.split("/")[2]
This_Dev = re.sub("[0-9]*$", "", This_Dev)
This_Dev = "/dev/" + This_Dev
This_SAS = line.split(" ")[-3]
This_SAS = This_SAS.split("-")[1]
This_SAS = This_SAS.split("x")[1]
Debug("map_SAS_to_Dev():: Adding Dev " + This_Dev + " SAS " + This_SAS)
Map[This_SAS] = This_Dev
Debug("map_SAS_to_Dev():: Map of PD_WWN to Dev = " + str(Map))
# Check for the presence of virtual disks, and generate a PD -> VD dict for mapping if any are found
Virtual_Disks_Found = False
for key in Map.keys():
if re.search("^600", key):
Virtual_Disks_Found = True
if not 'PD_to_VD_Map' in locals():
PD_to_VD_Map = map_pd_to_vd_with_storcli()
Debug("map_SAS_to-Dev():: Map of PD_WWN to VD_WWN = " + str(PD_to_VD_Map))
break
if Virtual_Disks_Found:
Dict_VD_to_PD = {}
for i in PD_to_VD_Map:
Dict_VD_to_PD[i[5]] = hex(int(i[3], 16) + 1).split("x")[1].lower()
Debug("map_SAS_to_Dev():: Map_Dict = " + str(Dict_VD_to_PD))
# Remap virtual disks to their corresponding physical disk
tmp_Map = dict(Map)
for key in Map.keys():
Debug("map_SAS_to_Dev():: Scanning 1st pass key " + key + " and val " + tmp_Map[key])
if key in Dict_VD_to_PD:
Debug("map_SAS_to_Dev():: Remapping 1st pass " + key + " to " + Dict_VD_to_PD[key])
tmp_Map[Dict_VD_to_PD[key]] = tmp_Map.pop(key)
Map = dict(tmp_Map)
Debug("def map_SAS_to_Dev() exit")
return(Map)
def map_pd_to_vd_with_storcli():
"""
Find the mapping between virtual disk and physical disk on computers with a "storcli64" accesssible HBA
"""
VD_to_PD_Map = {}
VD = []
scsi_naa_id = ""
PD = []
for line in SysExec("storcli64 /c0 /vall show all").splitlines():
if not re.search("/c0/|SCSI NAA| HDD ", line):
continue
if re.search("/c0/", line):
VD = line.split("/")[2].split()[0]
if re.search(" HDD ", line):
PD.append(line.split()[0])
if re.search("SCSI NAA", line):
scsi_naa_id = line.split("=")[1].strip()
if PD and VD and scsi_naa_id:
VD_to_PD_Map[VD] = {}
VD_to_PD_Map[VD]["scsi_naa_id"] = scsi_naa_id
VD_to_PD_Map[VD]["PD_List"] = PD
VD = []
scsi_naa_id = ""
PD = []
PD_to_VD_Map = []
for VD, list in VD_to_PD_Map.items():
PD_List = VD_to_PD_Map[VD]["PD_List"]
for i in PD_List:
e = i.split(":")[0]
s = i.split(":")[1]
for line in SysExec("storcli64 /c0/e" + str(e) + "/s" + str(s) + " show all").splitlines():
if re.search("^WWN", line):
WWN = line.split("=")[1].strip().lower()
Debug("map_pd_to_vd_with_storcli():: pd_wwn = " + WWN + " and vd_wwn = " + VD_to_PD_Map[VD]["scsi_naa_id"])
PD_to_VD_Map.append([i, e, s, WWN.lower(), VD, VD_to_PD_Map[VD]["scsi_naa_id"].lower()])
return(PD_to_VD_Map)
def map_Backplane_Slot_to_SAS_with_sgses(AllBackplanes):
"""
This will return a mapping of Backplane/Slot to SAS address using sg_ses.
sg_ses only returns one variable bit (SAS address)
"""
Debug("def map_Backplane_Slot_to_SAS_with_sgses() entry")
Map = {}
Debug("map_Backplane_Slot_to_SAS_with_sgses:: AllBackplanes = " + str(AllBackplanes))
for This_Backplane in AllBackplanes:
Debug("map_Backplane_Slot_to_SAS_with_sgses:: This_Backplane = " + str(This_Backplane))
Map[This_Backplane] = {}
output_sgses = SysExec("sg_ses -p aes " + This_Backplane)
val_slot = None
val_sas = None
for line in output_sgses.splitlines():
if not re.search("Element index:", line) and not re.search("SAS address", line):
continue
if re.search("attached SAS address", line):
continue
if re.search("Element index:", line):
val_slot = line.split(":")[1]
val_slot = val_slot.split(" ")[1]
if re.search("SAS address", line):
val_sas = line.split(":")[1]
val_sas = re.sub(" ", "", val_sas)
val_sas = re.sub("^0x", "", val_sas).lower()
if val_slot and val_sas:
Debug("map_Backplane_Slot_to_SAS_with_sgses():: Backplane " + This_Backplane + " slot " + str(val_slot) + " maps to SAS " + val_sas)
Map[This_Backplane][val_slot] = val_sas
val_slot = None
val_sas = None
Debug("def map_Backplane_Slot_to_SAS_with_sgses() exit")
return(Map)
def map_intermediate_SAS_to_WWN_with_MegaCli():
"""
Return a map of SAS to WWN using the LSI MegaCLI utility. This is necessary for cards
using our 2nd generation HBA controller ("LSI_Thunderbolt")
"""
Debug("def map_intermediate_SAS_to_WWN_with_MegaCli() entry")
Map = {}
val_wwn = None
val_sas = None
output_megacli = SysExec("MegaCli64 -PDList -aALL -NoLog")
for line in output_megacli.splitlines():
if not re.search("WWN", line) and not re.search("SAS Address", line):
continue
if re.search("WWN", line):
val_wwn = line.split(":")[-1].strip().lower()
elif re.search("SAS Address", line):
SAS = line.split(":")[-1]
val_sas = SAS.split("x")[-1].strip().lower()
# Sometimes there are multiple SAS values. Ignore ones that are 0
if val_sas == "0":
val_sas = None
continue
if val_wwn and val_sas:
# Extra hacky, but necessary. This is a guess, but the LSI controller appears to use the
# drives's WWN if it has one, and autogenerates one if it doesn't. The former case appears
# to include some of our SAS drives (not SATA drives). I'm not sure if this is the textbook
# solution, but it works in our case.
if val_sas.startswith("5000c"):
val_wwn = hex(int(val_sas, 16) + 2).split("x")[1].lower()
Debug("map_intermediate_SAS_to_WWN_with_MegaCli():: SAS " + str(val_sas) + " maps to WWN " + str(val_wwn))
Map[val_sas] = val_wwn
val_wwn = None
val_sas = None
Debug("def map_intermediate_SAS_to_WWN_with_MegaCli() exit")
return(Map)
def map_intermediate_SAS_to_WWN_with_sas2ircu():
"""
This will return a mapping the intermediate SAS to WWN addreses using sas2ircu which is
necessary for the LSI_Falcon HBA controllers.
"""
Debug("def map_intermediate_SAS_to_WWN_with_sas2ircu() entry")
Map = {}
val_device = None
val_sas = None
val_wwn = None
output_sas2ircu = SysExec("sas2ircu 0 display")
for line in output_sas2ircu.splitlines():
if not re.search("Device is a", line) and \
not re.search("SAS Address", line) and \
not re.search("GUID", line):
continue
if re.search("Device is a", line):
val_device = re.sub("Device is a ", "", line)
elif re.search("SAS Address", line):
val_sas = line.split(":")[1]
val_sas = re.sub(" ", "", val_sas)
val_sas = re.sub("-", "", val_sas).lower()
elif re.search("GUID", line):
val_wwn = line.split(":")[1]
val_wwn = re.sub(" ", "", val_wwn)
Debug("map_intermediate_SAS_to_WWN_with_sas2ircu():: val_device = " + str(val_device) + " val_sas = " + str(val_sas) + " val_wwn = " + str(val_wwn))
if val_device and val_sas and val_wwn:
if val_device == "Hard disk":
Map[val_sas] = val_wwn
val_device = None
val_sas = None
val_wwn = None
Debug("def map_intermediate_SAS_to_WWN_with_sas2ircu() exit")
return(Map)
def fudge_SAS_to_Dev_map(SAS_to_Dev, SAS_Controller):
"""
This function tries to encapsulate the ideosyncracies of each HBA controller
so we can output a consistent SAS_to_Dev Map
"""
Debug("def fudge_SAS_to_Dev_map() entry")
Remap_SAS_to_Dev = {}
if SAS_Controller == "LSI_Falcon":
Remap_SAS_to_WWN = map_intermediate_SAS_to_WWN_with_sas2ircu()
for This_SAS, This_WWN in Remap_SAS_to_WWN.items():
if This_WWN in SAS_to_Dev:
This_Dev = SAS_to_Dev[This_WWN]
else:
This_Dev = "Empty_Slot"
Remap_SAS_to_Dev[This_SAS] = This_Dev
if SAS_Controller == "LSI_Thunderbolt":
Remap_SAS_to_WWN = map_intermediate_SAS_to_WWN_with_MegaCli()
for This_SAS, This_WWN in Remap_SAS_to_WWN.items():
if This_WWN in SAS_to_Dev:
This_Dev = SAS_to_Dev[This_WWN]
else:
This_Dev = "Empty_Slot"
Remap_SAS_to_Dev[This_SAS] = This_Dev
if SAS_Controller == "LSI_Invader" or SAS_Controller == "LSI_FusionMPT":
# See if we have virtual drives
Virtual_Disks_Present = False
for line in SysExec("storcli64 /cALL /vALL show").splitlines():
if re.search("Status", line):
if re.search("Success", line):
Virtual_Disks_Present = True
Debug("fudge_SAS_to_Dev_map():: Virtual_Disks_Present = " + str(Virtual_Disks_Present))
for This_SAS, This_Dev in SAS_to_Dev.items():
if not Virtual_Disks_Present:
New_SAS = hex(int(This_SAS, 16) - 2).split("x")[1].lower()
else:
New_SAS = This_SAS
Debug("fudge_SAS_to_Dev_map():: New_SAS = " + New_SAS)
Remap_SAS_to_Dev[New_SAS] = This_Dev
Debug("def fudge_SAS_to_Dev_map() exit")
return(Remap_SAS_to_Dev)
def map_Backplane_Slot_to_Dev(AllBackplanes):
"""
This function returns a map of backplane/slot to /dev/entry
"""
Debug("def map_Backplane_Slot_to_Dev() entry")
Map = {}
Backplane_Slot_to_SAS = map_Backplane_Slot_to_SAS_with_sgses(AllBackplanes)
SAS_to_Dev = fudge_SAS_to_Dev_map(map_SAS_to_Dev(), SAS_Controller)
for This_Backplane in AllBackplanes:
Map[This_Backplane] = {}
NumSlots = int(AllBackplanes[This_Backplane]["NumSlots"])
Debug("map_Backplane_Slot_to_Dev():: Working on Backplane " + str(This_Backplane) + " with NumSlots " + str(NumSlots))
for slot in range(0, NumSlots):
if This_Backplane not in Backplane_Slot_to_SAS:
Debug("map_Backplane_Slot_to_Dev():: ERROR! I couldn't find Backplane " + This_Backplane + " listed in Backplane_Slot_to_SAS dict")
continue
if str(slot) not in Backplane_Slot_to_SAS[This_Backplane]:
Debug("map_Backplane_Slot_to_Dev():: ERROR! I couldn't find slot " + str(slot) + " listed in Backplane_Slot_to_SAS[" + This_Backplane + "] dict")
continue
SAS = Backplane_Slot_to_SAS[This_Backplane][str(slot)]
SAS = re.sub("0x","", SAS)
This_Dev = "Empty_Slot"
if SAS in SAS_to_Dev:
This_Dev = SAS_to_Dev[SAS]
Debug("map_Backplane_Slot_to_Dev():: Backplane = " + This_Backplane + " and Slot = " + str(slot) + " and SAS = " + SAS + " and Dev = " + This_Dev)
Map[This_Backplane][slot] = This_Dev
Debug("def map_Backplane_Slot_to_Dev() exit")
return(Map)
#############################################################################
# Main Loop
#############################################################################
SAS_Controller = Get_SASController()
Backplane_List = FindBackplanes()
Backplane_Slot_to_Dev = map_Backplane_Slot_to_Dev(Backplane_List)
Dev_to_RID = map_Dev_to_RID()
for Backplane in Backplane_List:
Backplane_Alias = Backplane_List[Backplane]["Alias"]
for i in range(0, int(Backplane_List[Backplane]["NumSlots"])):
if Backplane not in Backplane_Slot_to_Dev:
Debug("MAIN LOOP:: Error! No Backplane " + Backplane + " in Backplane_Slot_to_Dev dict")
continue
if i not in Backplane_Slot_to_Dev[Backplane]:
Debug("MAIN LOOP:: Error! No Slot " + str(i) + " in Backplane_Slot_to_Dev[" + Backplane + "] dict")
continue
Dev = Backplane_Slot_to_Dev[Backplane][i]
Rid = "Empty"
if Dev in Dev_to_RID:
Rid = Dev_to_RID[Dev]
LedState = GetLocateLEDState(Backplane, i)
Output.append([Backplane_Alias, str(i), LedState, Dev, Rid])
x = PrettyTable(["Backplane", "Slot", "Locate LED", "Dev", "RID"])
x.padding_width = 1
x.align = "l"
for row in Output:
x.add_row(row)
print(x)