From aea18165a86569d7d56e789916a8c9fa14334f88 Mon Sep 17 00:00:00 2001 From: Sujin Kang Date: Fri, 13 Dec 2019 12:44:11 -0800 Subject: [PATCH] Add watchdog-control service to disable watchdog during bootup (#3877) * Add watchdog-control service to disable watchdog during bootup Disable only if it's applicable and the watchdog is enabled. * Address the review comment * Correct the watchdog start script name * Change to call common watchdog api instead of platform specific * Start watchdog control service after swss starts * advance sonic-utility submodule --- .../build_templates/sonic_debian_extension.j2 | 5 +++++ .../watchdog-control/watchdog-control.service | 10 +++++++++ .../watchdog-control/watchdog-control.sh | 22 +++++++++++++++++++ src/sonic-utilities | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 files/image_config/watchdog-control/watchdog-control.service create mode 100644 files/image_config/watchdog-control/watchdog-control.sh diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index e12ac17b66..7cfe496a36 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -138,6 +138,11 @@ sudo sed -i -e '/^passwd/s/ tacplus//' $FILESYSTEM_ROOT/etc/nsswitch.conf # Copy crontabs sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/ +# Copy watchdog-control files +sudo LANG=C cp $IMAGE_CONFIGS/watchdog-control/watchdog-control.sh $FILESYSTEM_ROOT/usr/local/bin/watchdog-control.sh +sudo LANG=C cp $IMAGE_CONFIGS/watchdog-control/watchdog-control.service $FILESYSTEM_ROOT/etc/systemd/system/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable watchdog-control.service + # Copy NTP configuration files and templates sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service diff --git a/files/image_config/watchdog-control/watchdog-control.service b/files/image_config/watchdog-control/watchdog-control.service new file mode 100644 index 0000000000..f3c2469486 --- /dev/null +++ b/files/image_config/watchdog-control/watchdog-control.service @@ -0,0 +1,10 @@ +[Unit] +Description=watchdog control service +After=swss.service + +[Service] +Type=simple +ExecStart=/usr/bin/watchdog-control.sh + +[Install] +WantedBy=multi-user.target diff --git a/files/image_config/watchdog-control/watchdog-control.sh b/files/image_config/watchdog-control/watchdog-control.sh new file mode 100644 index 0000000000..124d1c01f6 --- /dev/null +++ b/files/image_config/watchdog-control/watchdog-control.sh @@ -0,0 +1,22 @@ +#! /bin/bash + +VERBOSE=no + +function debug() +{ + /usr/bin/logger "$0 : $1" + if [[ x"${VERBOSE}" == x"yes" ]]; then + echo "$(date) $0: $1" + fi +} + + +function disable_watchdog() +{ + if [[ -x /usr/bin/watchdog ]]; then + debug "Disabling Watchdog during bootup" + /usr/bin/watchdog -d + fi +} + +disable_watchdog diff --git a/src/sonic-utilities b/src/sonic-utilities index 8237848b73..792df2038e 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit 8237848b73169c7ab3d88e3e309533a88fa6891d +Subproject commit 792df2038ef7f270b46f8e6d3c2c0a73ceb25911