Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,8 @@ def test_CmisManagerTask_need_lp_mode_for_dpdeinit(self, appl, host_assign, vend
@patch('xcvrd.xcvrd.platform_chassis')
@patch('xcvrd.xcvrd_utilities.port_mapping.subscribe_port_update_event', MagicMock(return_value=(None, None)))
@patch('xcvrd.xcvrd_utilities.port_mapping.handle_port_update_event', MagicMock())
@patch('swsscommon.swsscommon.WarmStart', MagicMock())
@patch('swsscommon.swsscommon.RestartWaiter', MagicMock())
def test_CmisManagerTask_task_run_stop(self, mock_chassis):
mock_object = MagicMock()
mock_object.get_presence = MagicMock(return_value=True)
Expand Down Expand Up @@ -1381,6 +1383,8 @@ def test_CmisManagerTask_post_port_active_apsel_to_db(self):
@patch('xcvrd.xcvrd._wrapper_get_sfp_type', MagicMock(return_value='QSFP_DD'))
@patch('xcvrd.xcvrd.CmisManagerTask.wait_for_port_config_done', MagicMock())
@patch('xcvrd.xcvrd.is_cmis_api', MagicMock(return_value=True))
@patch('swsscommon.swsscommon.WarmStart', MagicMock())
@patch('swsscommon.swsscommon.RestartWaiter', MagicMock())
def test_CmisManagerTask_task_worker(self, mock_chassis):
mock_xcvr_api = MagicMock()
mock_xcvr_api.set_datapath_deinit = MagicMock(return_value=True)
Expand Down
22 changes: 17 additions & 5 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,13 @@ def is_fast_reboot_enabled():
fastboot_enabled = subprocess.check_output('sonic-db-cli STATE_DB hget "FAST_RESTART_ENABLE_TABLE|system" enable', shell=True, universal_newlines=True)
return "true" in fastboot_enabled

def is_warm_reboot_enabled():
warmstart = swsscommon.WarmStart()
warmstart.initialize("xcvrd", "pmon")
warmstart.checkWarmStart("xcvrd", "pmon", False)
is_warm_start = warmstart.isWarmStart()
return is_warm_start

# Get port speed and lane config from CONFIG DB
def get_port_speed_and_lane_config():
port_dict = {}
Expand Down Expand Up @@ -1338,6 +1345,13 @@ def wait_for_port_config_done(self, namespace):
if key in ["PortConfigDone", "PortInitDone"]:
break

def wait_for_warm_reboot_done(self):
is_warm_start = is_warm_reboot_enabled()

if is_warm_start:
self.log_notice("Delay CMISManager until warmboot done")
swsscommon.RestartWaiter.waitWarmBootDone()

def need_lp_mode_for_dpdeinit(self, api, appl):
try:
host_assign = api.get_host_lane_assignment_option(appl)
Expand All @@ -1358,6 +1372,8 @@ def task_worker(self):
for namespace in self.namespaces:
self.wait_for_port_config_done(namespace)

self.wait_for_warm_reboot_done()

# APPL_DB for CONFIG updates, and STATE_DB for insertion/removal
sel, asic_context = port_mapping.subscribe_port_update_event(self.namespaces, helper_logger)
while not self.task_stopping_event.is_set():
Expand Down Expand Up @@ -1949,10 +1965,7 @@ def _post_port_sfp_info_and_dom_thr_to_db_once(self, port_mapping, xcvr_table_he
retry_eeprom_set = set()
port_dict = get_port_speed_and_lane_config()

warmstart = swsscommon.WarmStart()
warmstart.initialize("xcvrd", "pmon")
warmstart.checkWarmStart("xcvrd", "pmon", False)
is_warm_start = warmstart.isWarmStart()
is_warm_start = is_warm_reboot_enabled()

# Post all the current interface sfp/dom threshold info to STATE_DB
logical_port_list = port_mapping.logical_port_list
Expand Down Expand Up @@ -2578,7 +2591,6 @@ def wait_for_port_config_done(self, namespace):
if key in ["PortConfigDone", "PortInitDone"]:
break


# Initialize daemon
def init(self):
global platform_sfputil
Expand Down