diff --git a/scripts/express-reboot b/scripts/express-reboot new file mode 120000 index 0000000000..c912fdc7e5 --- /dev/null +++ b/scripts/express-reboot @@ -0,0 +1 @@ +fast-reboot \ No newline at end of file diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 5c1a32f50e..cb84e6eaef 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -171,7 +171,7 @@ function init_warm_reboot_states() # If the current running instance was booted up with warm reboot. Then # the current DB contents will likely mark warm reboot is done. # Clear these states so that the next boot up image won't get confused. - if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then + if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then sonic-db-cli STATE_DB eval " for _, key in ipairs(redis.call('keys', 'WARM_RESTART_TABLE|*')) do redis.call('hdel', key, 'state') @@ -197,8 +197,13 @@ function request_pre_shutdown() debug "Requesting platform reboot pre-check ..." ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} ${REBOOT_TYPE} fi - debug "Requesting pre-shutdown ..." - STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pre &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi) + if [[ "$REBOOT_TYPE" = "express-reboot" ]]; then + debug "Requesting express boot pre-shutdown ..." + STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pxe &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi) + else + debug "Requesting pre-shutdown ..." + STATE=$(timeout 5s docker exec syncd /usr/bin/syncd_request_shutdown --pre &> /dev/null; if [[ $? == 124 ]]; then echo "timed out"; fi) + fi if [[ x"${STATE}" == x"timed out" ]]; then error "Failed to request pre-shutdown" fi @@ -245,7 +250,7 @@ function backup_database() { debug "Backing up database ..." - if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then + if [[ "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then # Advanced reboot: dump state to host disk sonic-db-cli ASIC_DB FLUSHDB > /dev/null sonic-db-cli COUNTERS_DB FLUSHDB > /dev/null @@ -475,7 +480,7 @@ function check_docker_exec() function check_db_integrity() { - if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then + if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then CHECK_DB_INTEGRITY=0 /usr/local/bin/check_db_integrity.py || CHECK_DB_INTEGRITY=$? if [[ CHECK_DB_INTEGRITY -ne 0 ]]; then @@ -520,7 +525,7 @@ function reboot_pre_check() # Make sure ASIC configuration has not changed between images ASIC_CONFIG_CHECK_SCRIPT="/usr/local/bin/asic_config_check" ASIC_CONFIG_CHECK_SUCCESS=0 - if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then + if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then ASIC_CONFIG_CHECK_EXIT_CODE=0 ${ASIC_CONFIG_CHECK_SCRIPT} || ASIC_CONFIG_CHECK_EXIT_CODE=$? @@ -604,6 +609,9 @@ function check_conflict_boot_in_fw_update() { "warm-reboot") FW_AU_TASK_FILE_EXP="${FIRMWARE_AU_STATUS_DIR}/warm_fw_au_task" ;; + "express-reboot") + FW_AU_TASK_FILE_EXP="${FIRMWARE_AU_STATUS_DIR}/express_fw_au_task" + ;; esac FW_AU_TASK_FILE=$(compgen -G ${FW_AU_TASK_FILE_REGEX}) || true 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 exit $? fi +sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +if [[ "$REBOOT_TYPE" = "express-reboot" ]] && [[ "$sonic_asic_type" != "cisco-8000" ]]; then + echo "eXpress Boot is not supported" + exit "${EXIT_FAILURE}" +fi check_conflict_boot_in_fw_update -sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) - # Check reboot type supported BOOT_TYPE_ARG="cold" case "$REBOOT_TYPE" in @@ -662,6 +673,12 @@ case "$REBOOT_TYPE" in trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM config warm_restart enable system ;; + "express-reboot") + check_warm_restart_in_progress + BOOT_TYPE_ARG="express" + trap clear_boot EXIT HUP INT QUIT TERM KILL ABRT ALRM + config warm_restart enable system + ;; *) error "Not supported reboot type: $REBOOT_TYPE" exit "${EXIT_NOT_SUPPORTED}" @@ -710,7 +727,6 @@ if [[ "$sonic_asic_type" == "mellanox" ]]; then fi fi - if is_secureboot && grep -q aboot_machine= /host/machine.conf; then load_aboot_secureboot_kernel else @@ -731,7 +747,7 @@ init_warm_reboot_states setup_control_plane_assistant TEAMD_INCREASE_RETRY_COUNT=0 -if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ]]; then +if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then TEAMD_RETRY_COUNT_PROBE_RC=0 /usr/local/bin/teamd_increase_retry_count.py --probe-only || TEAMD_RETRY_COUNT_PROBE_RC=$? if [[ ${TEAMD_RETRY_COUNT_PROBE_RC} -ne 0 ]]; then @@ -746,7 +762,7 @@ if [[ "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ] fi fi -if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then +if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" || "$REBOOT_TYPE" = "fast-reboot" ]]; then # Freeze orchagent for warm restart # Ask orchagent_restart_check to try freeze 5 times with interval of 2 seconds, # 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 fi fi -if [[ ( "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" ) && "${TEAMD_INCREASE_RETRY_COUNT}" -eq 1 ]]; then +if [[ ( "${REBOOT_TYPE}" = "warm-reboot" || "${REBOOT_TYPE}" = "fastfast-reboot" || "${REBOOT_TYPE}" = "express-reboot" ) && "${TEAMD_INCREASE_RETRY_COUNT}" -eq 1 ]]; then /usr/local/bin/teamd_increase_retry_count.py fi @@ -817,6 +833,10 @@ for timer in ${TIMERS}; do debug "Stopped ${timer} ..." done +if [[ "${REBOOT_TYPE}" == "express-reboot" ]]; then + SHUTDOWN_ORDER_FILE="/etc/sonic/warm-reboot_order" +fi + if [[ -f ${SHUTDOWN_ORDER_FILE} ]]; then SERVICES_TO_STOP="$(cat ${SHUTDOWN_ORDER_FILE})" else @@ -853,7 +873,7 @@ for service in ${SERVICES_TO_STOP}; do debug "Stopped ${service}" if [[ "${service}" = "swss" ]]; then - if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" ]]; then + if [[ "$REBOOT_TYPE" = "warm-reboot" || "$REBOOT_TYPE" = "fastfast-reboot" || "$REBOOT_TYPE" = "express-reboot" ]]; then # Pre-shutdown syncd initialize_pre_shutdown diff --git a/setup.py b/setup.py index 6459742d9f..4a11624a87 100644 --- a/setup.py +++ b/setup.py @@ -128,6 +128,7 @@ 'scripts/dump_nat_entries.py', 'scripts/debug_voq_chassis_packet_drops.sh', 'scripts/ecnconfig', + 'scripts/express-reboot', 'scripts/fabricstat', 'scripts/fanshow', 'scripts/fast-reboot',