Skip to content

Commit b767cb8

Browse files
authored
[cisco|express-boot]: Add support for cisco express boot in sonic-utilities (#3056)
[cisco|express-boot]: Add support for cisco express boot in sonic-utilities
1 parent f6b9912 commit b767cb8

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

scripts/express-reboot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fast-reboot

scripts/fast-reboot

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function init_warm_reboot_states()
171171
# If the current running instance was booted up with warm reboot. Then
172172
# the current DB contents will likely mark warm reboot is done.
173173
# Clear these states so that the next boot up image won't get confused.
174-
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
174+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
175175
sonic-db-cli STATE_DB eval "
176176
for _, key in ipairs(redis.call('keys', 'WARM_RESTART_TABLE|*')) do
177177
redis.call('hdel', key, 'state')
@@ -197,8 +197,13 @@ function request_pre_shutdown()
197197
debug "Requesting platform reboot pre-check ..."
198198
${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} ${REBOOT_TYPE}
199199
fi
200-
debug "Requesting pre-shutdown ..."
201-
STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pre &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi)
200+
if [[ "$REBOOT_TYPE" = "express-reboot" ]]; then
201+
debug "Requesting express boot pre-shutdown ..."
202+
STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pxe &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi)
203+
else
204+
debug "Requesting pre-shutdown ..."
205+
STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pre &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi)
206+
fi
202207
if [[ x"${STATE}" == x"timed out" ]]; then
203208
error "Failed to request pre-shutdown"
204209
fi
@@ -245,7 +250,7 @@ function backup_database()
245250
{
246251
debug "Backing up database ..."
247252
248-
if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
253+
if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
249254
# Advanced reboot: dump state to host disk
250255
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
251256
sonic-db-cli COUNTERS_DB FLUSHDB > /dev/null
@@ -475,7 +480,7 @@ function check_docker_exec()
475480
476481
function check_db_integrity()
477482
{
478-
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
483+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
479484
CHECK_DB_INTEGRITY=0
480485
/usr/local/bin/check_db_integrity.py || CHECK_DB_INTEGRITY=$?
481486
if [[ CHECK_DB_INTEGRITY -ne 0 ]]; then
@@ -520,7 +525,7 @@ function reboot_pre_check()
520525
# Make sure ASIC configuration has not changed between images
521526
ASIC_CONFIG_CHECK_SCRIPT="/usr/local/bin/asic_config_check"
522527
ASIC_CONFIG_CHECK_SUCCESS=0
523-
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
528+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then
524529
ASIC_CONFIG_CHECK_EXIT_CODE=0
525530
${ASIC_CONFIG_CHECK_SCRIPT} || ASIC_CONFIG_CHECK_EXIT_CODE=$?
526531
@@ -604,6 +609,9 @@ function check_conflict_boot_in_fw_update() {
604609
"warm-reboot")
605610
FW_AU_TASK_FILE_EXP="${FIRMWARE_AU_STATUS_DIR}/warm_fw_au_task"
606611
;;
612+
"express-reboot")
613+
FW_AU_TASK_FILE_EXP="${FIRMWARE_AU_STATUS_DIR}/express_fw_au_task"
614+
;;
607615
esac
608616
FW_AU_TASK_FILE=$(compgen -G ${FW_AU_TASK_FILE_REGEX}) || true
609617
if [[ -n "${FW_AU_TASK_FILE}" ]] && [[ ! -f "${FW_AU_TASK_FILE_EXP}" ]]; then
@@ -631,12 +639,15 @@ if [[ x"${DETACH}" == x"yes" && x"${ALREADY_DETACHED}" == x"" ]]; then
631639
exit $?
632640
fi
633641
642+
sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)
643+
if [[ "$REBOOT_TYPE" = "express-reboot" ]] && [[ "$sonic_asic_type" != "cisco-8000" ]]; then
644+
echo "eXpress Boot is not supported"
645+
exit "${EXIT_FAILURE}"
646+
fi
634647
635648
check_conflict_boot_in_fw_update
636649
637650
638-
sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)
639-
640651
# Check reboot type supported
641652
BOOT_TYPE_ARG="cold"
642653
case "$REBOOT_TYPE" in
@@ -662,6 +673,12 @@ case "$REBOOT_TYPE" in
662673
trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM
663674
config warm_restart enable system
664675
;;
676+
"express-reboot")
677+
check_warm_restart_in_progress
678+
BOOT_TYPE_ARG="express"
679+
trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM
680+
config warm_restart enable system
681+
;;
665682
*)
666683
error "Not supported reboot type: $REBOOT_TYPE"
667684
exit "${EXIT_NOT_SUPPORTED}"
@@ -710,7 +727,6 @@ if [[ "$sonic_asic_type" == "mellanox" ]]; then
710727
fi
711728
fi
712729
713-
714730
if is_secureboot && grep -q aboot_machine= /host/machine.conf; then
715731
load_aboot_secureboot_kernel
716732
else
@@ -731,7 +747,7 @@ init_warm_reboot_states
731747
setup_control_plane_assistant
732748
733749
TEAMD_INCREASE_RETRY_COUNT=0
734-
if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ]]; then
750+
if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then
735751
TEAMD_RETRY_COUNT_PROBE_RC=0
736752
/usr/local/bin/teamd_increase_retry_count.py --probe-only || TEAMD_RETRY_COUNT_PROBE_RC=$?
737753
if [[ ${TEAMD_RETRY_COUNT_PROBE_RC} -ne 0 ]]; then
@@ -746,7 +762,7 @@ if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ]
746762
fi
747763
fi
748764
749-
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
765+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then
750766
# Freeze orchagent for warm restart
751767
# Ask orchagent_restart_check to try freeze 5 times with interval of 2 seconds,
752768
# it is possible that the orchagent is in transient state and no opportunity to freeze
@@ -774,7 +790,7 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
774790
fi
775791
fi
776792
777-
if [[ ( "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ) && "${TEAMD_INCREASE_RETRY_COUNT}" -eq 1 ]]; then
793+
if [[ ( "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" || "${REBOOT_TYPE}" = "express-reboot" ) && "${TEAMD_INCREASE_RETRY_COUNT}" -eq 1 ]]; then
778794
/usr/local/bin/teamd_increase_retry_count.py
779795
fi
780796
@@ -817,6 +833,10 @@ for timer in ${TIMERS}; do
817833
debug "Stopped ${timer} ..."
818834
done
819835
836+
if [[ "${REBOOT_TYPE}" == "express-reboot" ]]; then
837+
SHUTDOWN_ORDER_FILE="/etc/sonic/warm-reboot_order"
838+
fi
839+
820840
if [[ -f ${SHUTDOWN_ORDER_FILE} ]]; then
821841
SERVICES_TO_STOP="$(cat ${SHUTDOWN_ORDER_FILE})"
822842
else
@@ -853,7 +873,7 @@ for service in ${SERVICES_TO_STOP}; do
853873
debug "Stopped ${service}"
854874
855875
if [[ "${service}" = "swss" ]]; then
856-
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then
876+
if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then
857877
# Pre-shutdown syncd
858878
initialize_pre_shutdown
859879

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
'scripts/dump_nat_entries.py',
129129
'scripts/debug_voq_chassis_packet_drops.sh',
130130
'scripts/ecnconfig',
131+
'scripts/express-reboot',
131132
'scripts/fabricstat',
132133
'scripts/fanshow',
133134
'scripts/fast-reboot',

0 commit comments

Comments
 (0)