41a9813018
- Why I did it To solve an issue with upgrade with fast-reboot including FW upgrade which has been introduced since moving to fast-reboot over warm-reboot infrastructure. As well, this introduces fast-reboot finalizing logic to determine fast-reboot is done. - How I did it Added logic to finalize-warmboot script to handle fast-reboot as well, this makes sense as using fast-reboot over warm-reboot this script will be invoked. The script will clear fast-reboot entry from state-db instead of previous implementation that relied on timer. The timer could expire in some scenarios between fast-reboot finished causing fallback to cold-reboot and possible crashes. As well this PR updates all services/scripts reading fast-reboot state-db entry to look for the updated value representing fast-reboot is active. - How to verify it Run fast-reboot and check that fast-reboot entry exists in state-db right after startup and being cleared as warm-reboot is finalized and not due to a timer.
33 lines
883 B
Bash
Executable File
33 lines
883 B
Bash
Executable File
#!/bin/bash
|
|
|
|
ntp_default_file='/etc/default/ntp'
|
|
ntp_temp_file='/tmp/ntp.orig'
|
|
|
|
reboot_type='cold'
|
|
|
|
function get_database_reboot_type()
|
|
{
|
|
SYSTEM_WARM_START=`sonic-db-cli STATE_DB hget "WARM_RESTART_ENABLE_TABLE|system" enable`
|
|
SYSTEM_FAST_START=`sonic-db-cli STATE_DB hget "FAST_RESTART_ENABLE_TABLE|system" enable`
|
|
|
|
if [[ x"${SYSTEM_WARM_START}" == x"true" ]]; then
|
|
reboot_type='warm'
|
|
elif [[ x"${SYSTEM_FAST_START}" == x"true" ]]; then
|
|
reboot_type='fast'
|
|
fi
|
|
}
|
|
|
|
function modify_ntp_default
|
|
{
|
|
cp ${ntp_default_file} ${ntp_temp_file}
|
|
sed -e "$1" ${ntp_temp_file} >${ntp_default_file}
|
|
}
|
|
|
|
sonic-cfggen -d -t /usr/share/sonic/templates/ntp.conf.j2 >/etc/ntp.conf
|
|
|
|
get_database_reboot_type
|
|
echo "Disabling NTP long jump for reboot type ${reboot_type} ..."
|
|
modify_ntp_default "s/NTPD_OPTS='-g'/NTPD_OPTS='-x'/"
|
|
|
|
systemctl --no-block restart ntp
|