Skip to content

Commit 3b78032

Browse files
authored
[fast-reboot] Remove FLEX_COUNTER_TABLE from config_db.json before reboot (sonic-net#1804)
To reduce fastboot dataplane downtime, delay flex counters by removing the flex_counter table from config_db before reboot. This is porting changes from 202012 branch to 201911 branch. Related PR for 202012 branch: sonic-net#1774
1 parent b6f0701 commit 3b78032

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/fast-reboot

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ DEVPATH="/usr/share/sonic/device"
1818
PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
1919
PLATFORM_PLUGIN="${REBOOT_TYPE}_plugin"
2020
SSD_FW_UPDATE="ssd-fw-upgrade"
21+
CONFIG_DB_FILE=/etc/sonic/config_db.json
2122

2223
# Require 100M available on the hard drive for warm reboot temp files,
2324
# Size is in 1K blocks:
@@ -415,7 +416,6 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
415416
# Dump the ARP and FDB tables to files also as default routes for both IPv4 and IPv6
416417
# into /host/fast-reboot
417418
DUMP_DIR=/host/fast-reboot
418-
CONFIG_DB_FILE=/etc/sonic/config_db.json
419419
mkdir -p $DUMP_DIR
420420
FAST_REBOOT_DUMP_RC=0
421421
/usr/bin/fast-reboot-dump.py -t $DUMP_DIR || FAST_REBOOT_DUMP_RC=$?
@@ -427,7 +427,7 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
427427
428428
FILTER_FDB_ENTRIES_RC=0
429429
# Filter FDB entries using MAC addresses from ARP table
430-
/usr/bin/filter_fdb_entries -f $DUMP_DIR/fdb.json -a $DUMP_DIR/arp.json -c $CONFIG_DB_FILE || FILTER_FDB_ENTRIES_RC=$?
430+
/usr/bin/filter_fdb_entries -f $DUMP_DIR/fdb.json -a $DUMP_DIR/arp.json -c ${CONFIG_DB_FILE} || FILTER_FDB_ENTRIES_RC=$?
431431
if [[ FILTER_FDB_ENTRIES_RC -ne 0 ]]; then
432432
error "Failed to filter FDb entries. Exit code: $FILTER_FDB_ENTRIES_RC"
433433
unload_kernel
@@ -576,6 +576,14 @@ then
576576
systemctl stop nps-modules-`uname -r`.service || debug "Ignore stopping nps service error $?"
577577
fi
578578
579+
if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
580+
# Remove FLEX_COUNTER_TABLE from config_db.json
581+
# This is done so that in fast-reboot recovery path, FLEX_COUNTER polling is delayed.
582+
# Delayed FLEX_COUNTER polling is an attempt to keep dataplane downtime below 30s threshold
583+
jq --indent 4 'del(.FLEX_COUNTER_TABLE)' ${CONFIG_DB_FILE} > ${CONFIG_DB_FILE}.new
584+
mv ${CONFIG_DB_FILE}.new ${CONFIG_DB_FILE}
585+
fi
586+
579587
# Update the reboot cause file to reflect that user issued this script
580588
# Upon next boot, the contents of this file will be used to determine the
581589
# cause of the previous reboot

0 commit comments

Comments
 (0)