Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[202012][fast-reboot] Remove FLEX_COUNTER_TABLE from config_db.json b… #1774

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
PLATFORM_PLUGIN="${REBOOT_TYPE}_plugin"
LOG_SSD_HEALTH="/usr/local/bin/log_ssd_health"
SSD_FW_UPDATE="ssd-fw-upgrade"
CONFIG_DB_FILE="/etc/sonic/config_db.json"
TAG_LATEST=yes

# Require 100M available on the hard drive for warm reboot temp files,
Expand Down Expand Up @@ -512,7 +513,6 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
# Dump the ARP and FDB tables to files also as default routes for both IPv4 and IPv6
# into /host/fast-reboot
DUMP_DIR=/host/fast-reboot
CONFIG_DB_FILE=/etc/sonic/config_db.json
mkdir -p $DUMP_DIR
FAST_REBOOT_DUMP_RC=0
/usr/local/bin/fast-reboot-dump.py -t $DUMP_DIR || FAST_REBOOT_DUMP_RC=$?
Expand All @@ -524,7 +524,7 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then

FILTER_FDB_ENTRIES_RC=0
# Filter FDB entries using MAC addresses from ARP table
/usr/local/bin/filter_fdb_entries -f $DUMP_DIR/fdb.json -a $DUMP_DIR/arp.json -c $CONFIG_DB_FILE || FILTER_FDB_ENTRIES_RC=$?
/usr/local/bin/filter_fdb_entries -f $DUMP_DIR/fdb.json -a $DUMP_DIR/arp.json -c ${CONFIG_DB_FILE} || FILTER_FDB_ENTRIES_RC=$?
if [[ FILTER_FDB_ENTRIES_RC -ne 0 ]]; then
error "Failed to filter FDb entries. Exit code: $FILTER_FDB_ENTRIES_RC"
unload_kernel
Expand Down Expand Up @@ -679,6 +679,14 @@ then
systemctl stop "$service_name"
fi

if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
# Remove FLEX_COUNTER_TABLE from config_db.json
# This is done so that in fast-reboot recovery path, FLEX_COUNTER polling is delayed.
# Delayed FLEX_COUNTER polling is an attempt keep dataplane downtime below 30s threshold
jq --indent 4 'del(.FLEX_COUNTER_TABLE)' ${CONFIG_DB_FILE} > ${CONFIG_DB_FILE}.new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we restore the config, if use has made some configs?

Copy link
Contributor Author

@vaibhavhd vaibhavhd Aug 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For branches (201811, 201911, 202012):
The user changed configuration to FLEX_COUNTER_TABLE will be reset. This is acceptable so far as for the upgrades, we anyway delete the /host/old_config/config_db.json file (basically removing all of the old config, and letting new image take the default config).

For newer branches (2021**):
Below PRs are targeted to address the issue of keeping the user configurations after reboot. The idea is to maintain a delay indicator that OA will check and decide to enable/disable flex counter polling.
sonic-net/sonic-buildimage#8500
sonic-net/sonic-swss-common#523
sonic-net/sonic-swss#1877
#1768

Adding you to the discussion thread about this topic.

mv ${CONFIG_DB_FILE}.new ${CONFIG_DB_FILE}
fi

# Update the reboot cause file to reflect that user issued this script
# Upon next boot, the contents of this file will be used to determine the
# cause of the previous reboot
Expand Down