@@ -156,6 +156,42 @@ function request_pre_shutdown()
156
156
}
157
157
}
158
158
159
+ function recover_issu_bank_file_instruction()
160
+ {
161
+ debug " To recover (${ISSU_BANK_FILE} ) file, do the following:"
162
+ debug " $ docker exec -it syncd sx_api_dbg_generate_dump.py"
163
+ debug " $ docker exec -it syncd cat /tmp/sdkdump | grep 'ISSU Bank'"
164
+ debug " Command above will print the VALUE of ISSU BANK - 0 or 1, use this VALUE in the next command"
165
+ debug " $ printf VALUE > /host/warmboot/issu_bank.txt"
166
+ }
167
+
168
+ function check_issu_bank_file()
169
+ {
170
+ ISSU_BANK_FILE=/host/warmboot/issu_bank.txt
171
+ MLNX_ISSU_BANK_BROKEN=102
172
+
173
+ if [[ ! -s " $ISSU_BANK_FILE " ]]; then
174
+ error " (${ISSU_BANK_FILE} ) does NOT exist or empty ..."
175
+ recover_issu_bank_file_instruction
176
+ if [[ " $1 " = true ]]; then
177
+ exit " ${MLNX_ISSU_BANK_BROKEN} "
178
+ fi
179
+ return
180
+ fi
181
+
182
+ issu_file_chars_count=` stat -c %s ${ISSU_BANK_FILE} ` ;
183
+ issu_file_content=` awk ' {print $0}' ${ISSU_BANK_FILE} `
184
+
185
+ if [[ $issu_file_chars_count != 1 ]] ||
186
+ [[ " $issu_file_content " != " 0" && " $issu_file_content " != " 1" ]]; then
187
+ error " (${ISSU_BANK_FILE} ) is broken ..."
188
+ recover_issu_bank_file_instruction
189
+ if [[ " $1 " = true ]]; then
190
+ exit " ${MLNX_ISSU_BANK_BROKEN} "
191
+ fi
192
+ fi
193
+ }
194
+
159
195
function wait_for_pre_shutdown_complete_or_fail()
160
196
{
161
197
debug " Waiting for pre-shutdown ..."
@@ -484,10 +520,20 @@ systemctl stop swss
484
520
if [[ " $REBOOT_TYPE " = " warm-reboot" || " $REBOOT_TYPE " = " fastfast-reboot" ]]; then
485
521
initialize_pre_shutdown
486
522
523
+ BEFORE_PRE_SHUTDOWN=true
524
+
525
+ if [[ " x$sonic_asic_type " == x" mellanox" ]]; then
526
+ check_issu_bank_file " $BEFORE_PRE_SHUTDOWN "
527
+ fi
528
+
487
529
request_pre_shutdown
488
530
489
531
wait_for_pre_shutdown_complete_or_fail
490
532
533
+ if [[ " x$sonic_asic_type " == x" mellanox" ]]; then
534
+ check_issu_bank_file
535
+ fi
536
+
491
537
# Warm reboot: dump state to host disk
492
538
if [[ " $REBOOT_TYPE " = " fastfast-reboot" ]]; then
493
539
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
0 commit comments