Skip to content

Commit b3189e3

Browse files
authored
[chassis][pmon][chassid] Enhance the chassid module on-line or off-line log messages with physical slot number (#530)
* [chassis][pmon][chassid] Enhance the chassid module on-line or off-line with physical slot num --------- Signed-off-by: mlok <[email protected]>
1 parent bf865c6 commit b3189e3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

sonic-chassisd/scripts/chassisd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,19 @@ class ModuleUpdater(logger.Logger):
315315
# identifying module operational status change. But the clean up will not be attempted for supervisor
316316

317317
if down_module_key not in self.down_modules:
318-
self.log_warning("Module {} went off-line!".format(key))
318+
self.log_warning("Module {} (Slot {}) went off-line!".format(key, module_info_dict[CHASSIS_MODULE_INFO_SLOT_FIELD]))
319319
self.down_modules[down_module_key] = {}
320320
self.down_modules[down_module_key]['down_time'] = time.time()
321321
self.down_modules[down_module_key]['cleaned'] = False
322+
self.down_modules[down_module_key]['slot'] = module_info_dict[CHASSIS_MODULE_INFO_SLOT_FIELD]
322323
continue
323324
else:
324325
# Module is operational. Remove it from down time tracking.
325326
if down_module_key in self.down_modules:
326-
self.log_notice("Module {} recovered on-line!".format(key))
327+
self.log_notice("Module {} (Slot {}) recovered on-line!".format(key, module_info_dict[CHASSIS_MODULE_INFO_SLOT_FIELD]))
327328
del self.down_modules[down_module_key]
328329
elif prev_status != ModuleBase.MODULE_STATUS_ONLINE:
329-
self.log_notice("Module {} is on-line!".format(key))
330+
self.log_notice("Module {} (Slot {}) is on-line!".format(key, module_info_dict[CHASSIS_MODULE_INFO_SLOT_FIELD] ))
330331

331332
module_cfg_status = self.get_module_admin_status(key)
332333

@@ -452,17 +453,17 @@ class ModuleUpdater(logger.Logger):
452453
if midplane_access is False and current_midplane_state == 'True':
453454
if self.is_module_reboot_expected(module_key):
454455
self.module_reboot_set_time(module_key)
455-
self.log_warning("Expected: Module {} lost midplane connectivity".format(module_key))
456+
self.log_warning("Expected: Module {} (Slot {}) lost midplane connectivity".format(module_key, module.get_slot()))
456457
else:
457-
self.log_warning("Unexpected: Module {} lost midplane connectivity".format(module_key))
458+
self.log_warning("Unexpected: Module {} (Slot {}) lost midplane connectivity".format(module_key, module.get_slot()))
458459
elif midplane_access is True and current_midplane_state == 'False':
459-
self.log_notice("Module {} midplane connectivity is up".format(module_key))
460+
self.log_notice("Module {} (Slot {}) midplane connectivity is up".format(module_key, module.get_slot()))
460461
# clean up the reboot_info_table
461462
if self.module_reboot_table.get(module_key) is not None:
462463
self.module_reboot_table._del(module_key)
463464
elif midplane_access is False and current_midplane_state == 'False':
464465
if self.is_module_reboot_system_up_expired(module_key):
465-
self.log_warning("Unexpected: Module {} midplane connectivity is not restored in {} seconds".format(module_key, self.linecard_reboot_timeout))
466+
self.log_warning("Unexpected: Module {} (Slot {}) midplane connectivity is not restored in {} seconds".format(module_key, module.get_slot(), self.linecard_reboot_timeout))
466467

467468
# Update db with midplane information
468469
fvs = swsscommon.FieldValuePairs([(CHASSIS_MIDPLANE_INFO_IP_FIELD, midplane_ip),
@@ -549,11 +550,12 @@ class ModuleUpdater(logger.Logger):
549550
for module in self.down_modules:
550551
if self.down_modules[module]['cleaned'] == False:
551552
down_time = self.down_modules[module]['down_time']
553+
slot = self.down_modules[module]['slot']
552554
delta = (time_now - down_time) / 60
553555
if delta >= CHASSIS_DB_CLEANUP_MODULE_DOWN_PERIOD:
554556
if module.startswith(ModuleBase.MODULE_TYPE_LINE):
555557
# Module is down for more than 30 minutes. Do the chassis clean up
556-
self.log_notice("Module {} is down for long time. Initiating chassis app db clean up".format(module))
558+
self.log_notice("Module {} (Slot {}) is down for long time. Initiating chassis app db clean up".format(module, slot))
557559
self._cleanup_chassis_app_db(module)
558560
self.down_modules[module]['cleaned'] = True
559561

0 commit comments

Comments
 (0)