diff --git a/sonic-xcvrd/tests/test_xcvrd.py b/sonic-xcvrd/tests/test_xcvrd.py index fcf206b..ca5164d 100644 --- a/sonic-xcvrd/tests/test_xcvrd.py +++ b/sonic-xcvrd/tests/test_xcvrd.py @@ -506,6 +506,7 @@ def test_post_port_sfp_info_to_db(self): @patch('xcvrd.xcvrd_utilities.port_mapping.PortMapping.logical_port_name_to_physical_port_list', MagicMock(return_value=[0])) @patch('xcvrd.xcvrd.platform_sfputil', MagicMock(return_value=[0])) + @patch('xcvrd.xcvrd.is_warm_start', MagicMock(return_value=False)) @patch('xcvrd.xcvrd._wrapper_get_presence', MagicMock(return_value=True)) @patch('xcvrd.xcvrd._wrapper_is_replaceable', MagicMock(return_value=True)) @patch('xcvrd.xcvrd.XcvrTableHelper', MagicMock()) diff --git a/sonic-xcvrd/xcvrd/xcvrd.py b/sonic-xcvrd/xcvrd/xcvrd.py index fa9780e..b4eca04 100644 --- a/sonic-xcvrd/xcvrd/xcvrd.py +++ b/sonic-xcvrd/xcvrd/xcvrd.py @@ -98,6 +98,8 @@ platform_sfputil = None # Global chassis object based on new platform api platform_chassis = None +# Global value to check if warm start +is_warm_start = False # Global logger instance for helper functions and classes # TODO: Refactor so that we only need the logger inherited @@ -1346,8 +1348,6 @@ def wait_for_port_config_done(self, namespace): 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() @@ -1965,8 +1965,6 @@ 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() - 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 for logical_port_name in logical_port_list: @@ -2595,6 +2593,7 @@ def wait_for_port_config_done(self, namespace): def init(self): global platform_sfputil global platform_chassis + global is_warm_start self.log_notice("XCVRD INIT: Start daemon init...") @@ -2637,6 +2636,8 @@ def init(self): media_settings_parser.load_media_settings() optics_si_parser.load_optics_si_settings() + is_warm_start = is_warm_reboot_enabled() + # Make sure this daemon started after all port configured self.log_notice("XCVRD INIT: Wait for port config is done") for namespace in self.namespaces: