forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Nokia-7215][armhf] Enable Watchdog service (sonic-net#16612)
Enable CPUWDT service to enable watchdog
- Loading branch information
1 parent
1a0268c
commit 905995f
Showing
5 changed files
with
115 additions
and
30 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
platform/marvell-armhf/sonic-platform-nokia/7215/scripts/cpu_wdt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/python | ||
|
||
from sonic_platform.chassis import Chassis | ||
from sonic_py_common import logger | ||
import time | ||
import os | ||
import signal | ||
import sys | ||
|
||
|
||
TIMEOUT=170 | ||
KEEPALIVE=55 | ||
sonic_logger = logger.Logger('Watchdog') | ||
sonic_logger.set_min_log_priority_info() | ||
time.sleep(60) | ||
chassis = Chassis() | ||
watchdog = chassis.get_watchdog() | ||
|
||
def stopWdtService(signal, frame): | ||
watchdog._disablewatchdog() | ||
sonic_logger.log_notice("CPUWDT Disabled: watchdog armed=%s" % watchdog.is_armed() ) | ||
sys.exit() | ||
|
||
def main(): | ||
|
||
signal.signal(signal.SIGHUP, signal.SIG_IGN) | ||
signal.signal(signal.SIGINT, stopWdtService) | ||
signal.signal(signal.SIGTERM, stopWdtService) | ||
|
||
watchdog.arm(TIMEOUT) | ||
sonic_logger.log_notice("CPUWDT Enabled: watchdog armed=%s" % watchdog.is_armed() ) | ||
|
||
|
||
while True: | ||
time.sleep(KEEPALIVE) | ||
watchdog._keepalive() | ||
sonic_logger.log_info("CPUWDT keepalive") | ||
done | ||
|
||
stopWdtService | ||
|
||
return | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
8 changes: 8 additions & 0 deletions
8
platform/marvell-armhf/sonic-platform-nokia/7215/service/cpu_wdt.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Unit] | ||
Description=CPU WDT | ||
After=nokia-7215init.service | ||
[Service] | ||
ExecStart=/usr/local/bin/cpu_wdt.py | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
platform/marvell-armhf/sonic-platform-nokia/debian/sonic-platform-nokia-7215.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
nokia-7215_plt_setup.sh usr/sbin | ||
7215/scripts/nokia-7215init.sh usr/local/bin | ||
7215/scripts/cpu_wdt.py usr/local/bin | ||
7215/service/nokia-7215init.service etc/systemd/system | ||
7215/service/cpu_wdt.service etc/systemd/system | ||
7215/service/fstrim.timer/timer-override.conf /lib/systemd/system/fstrim.timer.d | ||
7215/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/armhf-nokia_ixs7215_52x-r0 | ||
inband_mgmt.sh etc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters