Skip to content

Commit

Permalink
[system-health] delay system-health service start (sonic-net#20771)
Browse files Browse the repository at this point in the history
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 <stepanb@nvidia.com>
  • Loading branch information
stepanblyschak authored Dec 2, 2024
1 parent a6b9e1a commit f94d4f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/system-health/scripts/healthd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
System health monitor daemon for SONiC
"""

from swsscommon.swsscommon import RestartWaiter
RestartWaiter.waitAdvancedBootDone()

import signal
import threading
import time
Expand Down
7 changes: 4 additions & 3 deletions src/system-health/tests/test_system_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from .mock_connector import MockConnector

swsscommon.SonicV2Connector = MockConnector
swsscommon.RestartWaiter = MagicMock()

test_path = os.path.dirname(os.path.abspath(__file__))
telemetry_path = os.path.join(test_path, 'telemetry')
Expand All @@ -48,7 +49,7 @@
snmp-subagent EXITED Oct 19 01:53 AM
"""
device_info.get_platform = MagicMock(return_value='unittest')

device_runtime_metadata = {"DEVICE_RUNTIME_METADATA": {"ETHERNET_PORTS_PRESENT":True}}

def no_op(*args, **kwargs):
Expand Down Expand Up @@ -843,7 +844,7 @@ def test_publish_system_status_allowed_status():
sysmon = Sysmonitor()
sysmon.publish_system_status('UP')
sysmon.publish_system_status('DOWN')

expected_calls = [
(("UP",), {}),
(("DOWN",), {})
Expand All @@ -856,7 +857,7 @@ def test_publish_system_status():
sysmon = Sysmonitor()
sysmon.publish_system_status('UP')
result = swsscommon.SonicV2Connector.get(MockConnector, 0, "SYSTEM_READY|SYSTEM_STATE", 'Status')
assert result == "UP"
assert result == "UP"

@patch('health_checker.sysmonitor.Sysmonitor.get_all_system_status', test_get_all_system_status_ok())
@patch('health_checker.sysmonitor.Sysmonitor.publish_system_status', test_publish_system_status())
Expand Down

0 comments on commit f94d4f8

Please sign in to comment.