From fcc9c904c1a2753add041df9a561c726deb590af Mon Sep 17 00:00:00 2001 From: ngocdo Date: Tue, 18 May 2021 21:19:31 -0700 Subject: [PATCH] Store asic PCI ID in CHASSIS_STATE_DB and delete table at deinit() Signed-off-by: ngocdo --- sonic-chassisd/scripts/chassisd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sonic-chassisd/scripts/chassisd b/sonic-chassisd/scripts/chassisd index f064f652a..5fff02c4c 100644 --- a/sonic-chassisd/scripts/chassisd +++ b/sonic-chassisd/scripts/chassisd @@ -164,13 +164,15 @@ class ModuleUpdater(logger.Logger): state_db = daemon_base.db_connect("STATE_DB") self.chassis_table = swsscommon.Table(state_db, CHASSIS_INFO_TABLE) self.module_table = swsscommon.Table(state_db, CHASSIS_MODULE_INFO_TABLE) - self.asic_table = swsscommon.Table(state_db, CHASSIS_ASIC_INFO_TABLE) self.midplane_table = swsscommon.Table(state_db, CHASSIS_MIDPLANE_INFO_TABLE) self.info_dict_keys = [CHASSIS_MODULE_INFO_NAME_FIELD, CHASSIS_MODULE_INFO_DESC_FIELD, CHASSIS_MODULE_INFO_SLOT_FIELD, CHASSIS_MODULE_INFO_OPERSTATUS_FIELD] + chassis_state_db = daemon_base.db_connect("CHASSIS_STATE_DB") + self.asic_table = swsscommon.Table(chassis_state_db, CHASSIS_ASIC_INFO_TABLE) + self.midplane_initialized = try_get(chassis.init_midplane_switch, default=False) if not self.midplane_initialized: self.log_error("Chassisd midplane intialization failed") @@ -190,6 +192,10 @@ class ModuleUpdater(logger.Logger): if self.chassis_table is not None: self.chassis_table._del(CHASSIS_INFO_KEY_TEMPLATE.format(1)) + if self.asic_table is not None: + for key in self.asic_table.getKeys(): + self.asic_table.delete(key) + def modules_num_update(self): # Check if module list is populated num_modules = self.chassis.get_num_modules()