Skip to content

Commit

Permalink
add fast reboot check and dont send dict to get_change_event
Browse files Browse the repository at this point in the history
after warm or fast reboot done
  • Loading branch information
dbarashinvd committed Mar 14, 2024
1 parent 4ae9a3d commit a210b0b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit a210b0b

Please sign in to comment.