Skip to content

Commit

Permalink
[warm-reboot]: added pre-check for ISSU file (sonic-net#915)
Browse files Browse the repository at this point in the history
* [warm-reboot]: added pre-check for ISSU file

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>

* [warm-reboot]: fixed problems according to PR review comments

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>

* [warm-reboot]: added distinguish token and error code to clarify when issu_bank.txt was corrupted

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>

* [warm-reboot]: fixed indentation problems

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>

* [warm-reboot]: removed script interrupt when issu_bank.txt is broken

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>

* [warm-reboot]: added script interrupt if issu_bank.txt is broken before call request_pre_shutdown

Signed-off-by: Vadym Hlushko <vadymh@mellanox.com>
  • Loading branch information
vadymhlushko-mlnx authored and abdosi committed Aug 3, 2020
1 parent 4e1e61c commit 67a0c6c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,42 @@ function request_pre_shutdown()
}
}
function recover_issu_bank_file_instruction()
{
debug "To recover (${ISSU_BANK_FILE}) file, do the following:"
debug "$ docker exec -it syncd sx_api_dbg_generate_dump.py"
debug "$ docker exec -it syncd cat /tmp/sdkdump | grep 'ISSU Bank'"
debug "Command above will print the VALUE of ISSU BANK - 0 or 1, use this VALUE in the next command"
debug "$ printf VALUE > /host/warmboot/issu_bank.txt"
}
function check_issu_bank_file()
{
ISSU_BANK_FILE=/host/warmboot/issu_bank.txt
MLNX_ISSU_BANK_BROKEN=102
if [[ ! -s "$ISSU_BANK_FILE" ]]; then
error "(${ISSU_BANK_FILE}) does NOT exist or empty ..."
recover_issu_bank_file_instruction
if [[ "$1" = true ]]; then
exit "${MLNX_ISSU_BANK_BROKEN}"
fi
return
fi
issu_file_chars_count=`stat -c %s ${ISSU_BANK_FILE}`;
issu_file_content=`awk '{print $0}' ${ISSU_BANK_FILE}`
if [[ $issu_file_chars_count != 1 ]] ||
[[ "$issu_file_content" != "0" && "$issu_file_content" != "1" ]]; then
error "(${ISSU_BANK_FILE}) is broken ..."
recover_issu_bank_file_instruction
if [[ "$1" = true ]]; then
exit "${MLNX_ISSU_BANK_BROKEN}"
fi
fi
}
function wait_for_pre_shutdown_complete_or_fail()
{
debug "Waiting for pre-shutdown ..."
Expand Down Expand Up @@ -484,10 +520,20 @@ systemctl stop swss
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
initialize_pre_shutdown
BEFORE_PRE_SHUTDOWN=true
if [[ "x$sonic_asic_type" == x"mellanox" ]]; then
check_issu_bank_file "$BEFORE_PRE_SHUTDOWN"
fi
request_pre_shutdown
wait_for_pre_shutdown_complete_or_fail
if [[ "x$sonic_asic_type" == x"mellanox" ]]; then
check_issu_bank_file
fi
# Warm reboot: dump state to host disk
if [[ "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
Expand Down

0 comments on commit 67a0c6c

Please sign in to comment.