From 90f20753d950f6006afc16fc9adec8947282312b Mon Sep 17 00:00:00 2001 From: domingo-nexthop Date: Fri, 15 May 2026 10:14:01 -0700 Subject: [PATCH] save and restore ARP, FDB for fast reboot Signed-off-by: domingo-nexthop --- scripts/fast-reboot | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 33fa9f89875..27d4201684a 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -35,6 +35,9 @@ LOG_PATH="/var/log/${REBOOT_TYPE}.txt" UIMAGE_HDR_SIZE=64 REQUIRE_TEAMD_RETRY_COUNT=no +FAST_BOOT_DIR=/host/fast-reboot +FAST_REBOOT_DUMP=/usr/local/bin/fast-reboot-dump.py + EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_NOT_SUPPORTED=2 @@ -503,6 +506,25 @@ function backup_database() fi } +function dump_state_for_fast_boot() +{ + if [[ ! -x "$FAST_REBOOT_DUMP" ]]; then + debug "$FAST_REBOOT_DUMP not found; skipping fast-boot state dump" + return + fi + if [[ $NUM_ASIC -gt 1 ]]; then + debug "Multi-ASIC: skipping fast-boot state dump (unsupported)" + return + fi + rm -rf "$FAST_BOOT_DIR" + mkdir -p "$FAST_BOOT_DIR" + debug "Dumping FDB/ARP/route/serdes state to $FAST_BOOT_DIR ..." + if ! "$FAST_REBOOT_DUMP" -t "$FAST_BOOT_DIR"; then + debug "fast-reboot-dump.py exited $? — cleaning up $FAST_BOOT_DIR and continuing" + rm -rf "$FAST_BOOT_DIR" + fi +} + function check_mirror_session_acls() { debug "Checking if mirror session ACLs (arp, nd) programmed to ASIC successfully" @@ -1131,6 +1153,9 @@ if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" | execute_in_namespaces asic increase_teamd_retry_count fi +if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then + dump_state_for_fast_boot +fi # We are fully committed to reboot from this point on because critical # service will go down and we cannot recover from it.