Skip to content

Commit f94d4f8

Browse files
[system-health] delay system-health service start (sonic-net#20771)
Why I did it To improve boot time and stabilize boot time as well as fast-reboot downtime consistency. How I did it Delay system-health daemon till boot is finished, same as other daemons. Signed-off-by: Stepan Blyschak <[email protected]>
1 parent a6b9e1a commit f94d4f8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/system-health/scripts/healthd

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
System health monitor daemon for SONiC
66
"""
77

8+
from swsscommon.swsscommon import RestartWaiter
9+
RestartWaiter.waitAdvancedBootDone()
10+
811
import signal
912
import threading
1013
import time

src/system-health/tests/test_system_health.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from .mock_connector import MockConnector
2323

2424
swsscommon.SonicV2Connector = MockConnector
25+
swsscommon.RestartWaiter = MagicMock()
2526

2627
test_path = os.path.dirname(os.path.abspath(__file__))
2728
telemetry_path = os.path.join(test_path, 'telemetry')
@@ -48,7 +49,7 @@
4849
snmp-subagent EXITED Oct 19 01:53 AM
4950
"""
5051
device_info.get_platform = MagicMock(return_value='unittest')
51-
52+
5253
device_runtime_metadata = {"DEVICE_RUNTIME_METADATA": {"ETHERNET_PORTS_PRESENT":True}}
5354

5455
def no_op(*args, **kwargs):
@@ -843,7 +844,7 @@ def test_publish_system_status_allowed_status():
843844
sysmon = Sysmonitor()
844845
sysmon.publish_system_status('UP')
845846
sysmon.publish_system_status('DOWN')
846-
847+
847848
expected_calls = [
848849
(("UP",), {}),
849850
(("DOWN",), {})
@@ -856,7 +857,7 @@ def test_publish_system_status():
856857
sysmon = Sysmonitor()
857858
sysmon.publish_system_status('UP')
858859
result = swsscommon.SonicV2Connector.get(MockConnector, 0, "SYSTEM_READY|SYSTEM_STATE", 'Status')
859-
assert result == "UP"
860+
assert result == "UP"
860861

861862
@patch('health_checker.sysmonitor.Sysmonitor.get_all_system_status', test_get_all_system_status_ok())
862863
@patch('health_checker.sysmonitor.Sysmonitor.publish_system_status', test_publish_system_status())

0 commit comments

Comments
 (0)