diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py index ddc5ac599e03..11cbae95e659 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py @@ -69,6 +69,7 @@ PROC_CMDLINE = "/proc/cmdline" CMDLINE_STR_TO_LOOK_FOR = 'SONIC_BOOT_TYPE=' CMDLINE_VAL_TO_LOOK_FOR = 'fastfast' +CMDLINE_VAL_TO_LOOK_FOR_FAST_REBOOT = 'fast-reboot' MAX_EEPROM_ERROR_RESET_RETRIES = 4 @@ -98,6 +99,7 @@ def __init__(self, namespaces=None, main_thread_stop_event=None, q=None): self.setName("ModulesMgmtTask") self.register_hw_present_fds = [] self.is_warm_reboot = False + self.is_fast_reboot = False self.port_control_dict = {} # SFPs state machine @@ -161,7 +163,9 @@ def run(self): cmdline_dict[CMDLINE_STR_TO_LOOK_FOR] = proc_cmdline_str.split(CMDLINE_STR_TO_LOOK_FOR)[1] if CMDLINE_STR_TO_LOOK_FOR in cmdline_dict.keys(): self.is_warm_reboot = cmdline_dict[CMDLINE_STR_TO_LOOK_FOR] == CMDLINE_VAL_TO_LOOK_FOR - logger.log_info(f"system was warm rebooted is_warm_reboot: {self.is_warm_reboot}") + self.is_fast_reboot = cmdline_dict[CMDLINE_STR_TO_LOOK_FOR] == CMDLINE_VAL_TO_LOOK_FOR_FAST_REBOOT + logger.log_info(f"system was warm or fast rebooted is_warm_reboot: {self.is_warm_reboot} is_fast_reboot:" + f"{self.is_fast_reboot}") for port in range(num_of_ports): # check sysfs per port whether it's independent mode or legacy temp_module_sm = ModuleStateMachine(port_num=port, initial_state=STATE_HW_NOT_PRESENT @@ -661,7 +665,8 @@ def map_ports_final_state(self, dynamic=False): self.register_hw_present_fds.append(module_obj) else: port_status = '1' - self.sfp_changes_dict[str(module_obj.port_num + 1)] = port_status + if dynamic or (not self.is_warm_reboot and not self.is_fast_reboot): + self.sfp_changes_dict[str(module_obj.port_num + 1)] = port_status def delete_ports_from_dict(self, dynamic=False): detection_method = 'dynamic' if dynamic else 'static'