|
16 | 16 | import sys
|
17 | 17 | import threading
|
18 | 18 | import time
|
19 |
| - |
| 19 | + import subprocess |
| 20 | + |
20 | 21 | from sonic_py_common import daemon_base, device_info, logger
|
21 | 22 | from sonic_py_common import multi_asic
|
22 | 23 | from swsscommon import swsscommon
|
@@ -826,6 +827,18 @@ def init_port_sfp_status_tbl(port_mapping, stop_event=threading.Event()):
|
826 | 827 | else:
|
827 | 828 | update_port_transceiver_status_table(logical_port_name, xcvr_table_helper.get_status_tbl(asic_index), sfp_status_helper.SFP_STATUS_INSERTED)
|
828 | 829 |
|
| 830 | +def is_fast_reboot_enabled(): |
| 831 | + fastboot_enabled = False |
| 832 | + state_db_host = daemon_base.db_connect("STATE_DB") |
| 833 | + fastboot_tbl = swsscommon.Table(state_db_host, 'FAST_REBOOT') |
| 834 | + keys = fastboot_tbl.getKeys() |
| 835 | + |
| 836 | + if "system" in keys: |
| 837 | + output = subprocess.check_output('sonic-db-cli STATE_DB get "FAST_REBOOT|system"', shell=True, universal_newlines=True) |
| 838 | + if "1" in output: |
| 839 | + fastboot_enabled = True |
| 840 | + |
| 841 | + return fastboot_enabled |
829 | 842 | #
|
830 | 843 | # Helper classes ===============================================================
|
831 | 844 | #
|
@@ -1463,7 +1476,11 @@ def init(self):
|
1463 | 1476 | # Initialize xcvr table helper
|
1464 | 1477 | xcvr_table_helper = XcvrTableHelper()
|
1465 | 1478 |
|
1466 |
| - self.load_media_settings() |
| 1479 | + if is_fast_reboot_enabled(): |
| 1480 | + self.log_info("Skip loading media_settings.json in case of fast-reboot") |
| 1481 | + else: |
| 1482 | + self.load_media_settings() |
| 1483 | + |
1467 | 1484 | warmstart = swsscommon.WarmStart()
|
1468 | 1485 | warmstart.initialize("xcvrd", "pmon")
|
1469 | 1486 | warmstart.checkWarmStart("xcvrd", "pmon", False)
|
|
0 commit comments