Skip to content

Commit 988d8e1

Browse files
vadymhlushko-mlnxabdosi
authored andcommitted
[warm-reboot]: added automated recover for ISSU file (#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 913df4e commit 988d8e1

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
@@ -159,26 +159,21 @@ function request_pre_shutdown()
159159
fi
160160
}
161161
162-
function recover_issu_bank_file_instruction()
162+
function recover_issu_bank_file()
163163
{
164-
debug "To recover (${ISSU_BANK_FILE}) file, do the following:"
165-
debug "$ docker exec -it syncd sx_api_dbg_generate_dump.py"
166-
debug "$ docker exec -it syncd cat /tmp/sdkdump | grep 'ISSU Bank'"
167-
debug "Command above will print the VALUE of ISSU BANK - 0 or 1, use this VALUE in the next command"
168-
debug "$ printf VALUE > /host/warmboot/issu_bank.txt"
164+
debug "Recovering the (${ISSU_BANK_FILE}) file"
165+
docker exec -i syncd sx_api_dbg_generate_dump.py
166+
issu_bank_value=`docker exec -i syncd cat /tmp/sdkdump | grep 'ISSU Bank' | grep -o -E '[0-9]+'`
167+
printf $issu_bank_value > /host/warmboot/issu_bank.txt
169168
}
170169
171170
function check_issu_bank_file()
172171
{
173172
ISSU_BANK_FILE=/host/warmboot/issu_bank.txt
174-
MLNX_ISSU_BANK_BROKEN=102
175173
176174
if [[ ! -s "$ISSU_BANK_FILE" ]]; then
177175
error "(${ISSU_BANK_FILE}) does NOT exist or empty ..."
178-
recover_issu_bank_file_instruction
179-
if [[ "$1" = true ]]; then
180-
exit "${MLNX_ISSU_BANK_BROKEN}"
181-
fi
176+
recover_issu_bank_file
182177
return
183178
fi
184179
@@ -188,10 +183,7 @@ function check_issu_bank_file()
188183
if [[ $issu_file_chars_count != 1 ]] ||
189184
[[ "$issu_file_content" != "0" && "$issu_file_content" != "1" ]]; then
190185
error "(${ISSU_BANK_FILE}) is broken ..."
191-
recover_issu_bank_file_instruction
192-
if [[ "$1" = true ]]; then
193-
exit "${MLNX_ISSU_BANK_BROKEN}"
194-
fi
186+
recover_issu_bank_file
195187
fi
196188
}
197189
@@ -538,10 +530,8 @@ systemctl stop swss
538530
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
539531
initialize_pre_shutdown
540532
541-
BEFORE_PRE_SHUTDOWN=true
542-
543533
if [[ "x$sonic_asic_type" == x"mellanox" ]]; then
544-
check_issu_bank_file "$BEFORE_PRE_SHUTDOWN"
534+
check_issu_bank_file
545535
fi
546536
547537
request_pre_shutdown

0 commit comments

Comments
 (0)