Skip to content

Commit e1c52a0

Browse files
[warm-reboot]: added automated recover for ISSU file (sonic-net#1466)
#### What I did Modified pre-check for file `/host/warmboot/issu_bank.txt` in `warm-reboot` script. Added automated recovery of `/host/warmboot/issu_bank.txt` #### How I did it Modified the `warm-reboot` script. #### How to verify it Need to somehow corrupt the `/host/warmboot/issu_bank.txt` (list below) and then run the `warm-reboot` command. For testing I have modified the `warm-reboot` script - added corruption command before `check_issu_bank_file` function call. 1. Remove `issu_bank.txt` 2. Clear `issu_bank.txt` 3. Change characters count in `issu_bank.txt` 4. Write invalid content into `issu_bank.txt` #### Previous command output (if the output of a command-line utility has changed) ``` root@arc-switch1041:~# warm-reboot (/host/warmboot/issu_bank.txt) does NOT exist or empty ... To recover (/host/warmboot/issu_bank.txt) file, do the following: $ docker exec -it syncd sx_api_dbg_generate_dump.py $ docker exec -it syncd cat /tmp/sdkdump | grep 'ISSU Bank' Command above will print the VALUE of ISSU BANK - 0 or 1, use this VALUE in the next command $ printf VALUE > /host/warmboot/issu_bank.txt ``` #### New command output (if the output of a command-line utility has changed) ``` root@arc-switch1041:~# warm-reboot (/host/warmboot/issu_bank.txt) does NOT exist or empty ... Recovering the (/host/warmboot/issu_bank.txt) file ```
1 parent a4ae643 commit e1c52a0

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

scripts/fast-reboot

+8-18
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,21 @@ function request_pre_shutdown()
170170
}
171171
}
172172
173-
function recover_issu_bank_file_instruction()
173+
function recover_issu_bank_file()
174174
{
175-
debug "To recover (${ISSU_BANK_FILE}) file, do the following:"
176-
debug "$ docker exec -it syncd sx_api_dbg_generate_dump.py"
177-
debug "$ docker exec -it syncd cat /tmp/sdkdump | grep 'ISSU Bank'"
178-
debug "Command above will print the VALUE of ISSU BANK - 0 or 1, use this VALUE in the next command"
179-
debug "$ printf VALUE > /host/warmboot/issu_bank.txt"
175+
debug "Recovering the (${ISSU_BANK_FILE}) file"
176+
docker exec -i syncd sx_api_dbg_generate_dump.py
177+
issu_bank_value=`docker exec -i syncd cat /tmp/sdkdump | grep 'ISSU Bank' | grep -o -E '[0-9]+'`
178+
printf $issu_bank_value > /host/warmboot/issu_bank.txt
180179
}
181180
182181
function check_issu_bank_file()
183182
{
184183
ISSU_BANK_FILE=/host/warmboot/issu_bank.txt
185-
MLNX_ISSU_BANK_BROKEN=102
186184
187185
if [[ ! -s "$ISSU_BANK_FILE" ]]; then
188186
error "(${ISSU_BANK_FILE}) does NOT exist or empty ..."
189-
recover_issu_bank_file_instruction
190-
if [[ "$1" = true ]]; then
191-
exit "${MLNX_ISSU_BANK_BROKEN}"
192-
fi
187+
recover_issu_bank_file
193188
return
194189
fi
195190
@@ -199,10 +194,7 @@ function check_issu_bank_file()
199194
if [[ $issu_file_chars_count != 1 ]] ||
200195
[[ "$issu_file_content" != "0" && "$issu_file_content" != "1" ]]; then
201196
error "(${ISSU_BANK_FILE}) is broken ..."
202-
recover_issu_bank_file_instruction
203-
if [[ "$1" = true ]]; then
204-
exit "${MLNX_ISSU_BANK_BROKEN}"
205-
fi
197+
recover_issu_bank_file
206198
fi
207199
}
208200
@@ -599,10 +591,8 @@ if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; t
599591
# Pre-shutdown syncd
600592
initialize_pre_shutdown
601593
602-
BEFORE_PRE_SHUTDOWN=true
603-
604594
if [[ "x$sonic_asic_type" == x"mellanox" ]]; then
605-
check_issu_bank_file "$BEFORE_PRE_SHUTDOWN"
595+
check_issu_bank_file
606596
fi
607597
608598
request_pre_shutdown

0 commit comments

Comments
 (0)