Skip to content

Boot type during config reload after fast reboot is invalid #3697

@nazariig

Description

@nazariig

Description
After the fast reboot, on the next config reload, the system behaves in the same way as during the fast reboot flow.

It seems that the boot type detection logic in sonic-buildimage and sonic-sairedis are not aligned:

sonic-buildimage/files/scripts/syncd.sh

function getBootType()
{
    # same code snippet in files/build_templates/docker_image_ctl.j2
    case "$(cat /proc/cmdline)" in
    *SONIC_BOOT_TYPE=warm*)
        TYPE='warm'
        ;;
    *SONIC_BOOT_TYPE=fastfast*)
        TYPE='fastfast'
        ;;
    *SONIC_BOOT_TYPE=fast*|*fast-reboot*)
        TYPE=$(awk '{ if ($1 <= 180) print "fast"; else print "cold" }' /proc/uptime)
        ;;
    *)
        TYPE='cold'
    esac
    echo "${TYPE}"
}

sonic-sairedis/syncd/scripts/syncd_init_common.sh

case "$(cat /proc/cmdline)" in
  *SONIC_BOOT_TYPE=fastfast*)
    if [ -e /var/warmboot/warm-starting ]; then
        FASTFAST_REBOOT='yes'
    fi
    ;;
  *SONIC_BOOT_TYPE=fast*|*fast-reboot*)
     FAST_REBOOT='yes'
    ;;
  *)
     FAST_REBOOT='no'
     FASTFAST_REBOOT='no'
    ;;
esac

...

function set_start_type()
{
    if [ x"$WARM_BOOT" == x"true" ]; then
        CMD_ARGS+=" -t warm"
    elif [ x"$FAST_REBOOT" == x"yes" ]; then
        CMD_ARGS+=" -t fast"
    elif [ x"$FASTFAST_REBOOT" == x"yes" ]; then
        CMD_ARGS+=" -t fastfast"
    fi
}

Steps to reproduce the issue:

  1. fast-reboot
  2. config reload -y

Describe the results you received:

root@sonic:/home/admin# docker exec -ti syncd bash
root@sonic:/# ps -aux | grep [s]yncd
root        23  5.1  2.5 1265152 207064 pts/0  Sl   13:15   0:04 /usr/bin/syncd -u -p /tmp/sai.profile -t fast -r -m /usr/share/sonic/hwsku/port_config.ini

Describe the results you expected:

root@sonic:/home/admin# docker exec -ti syncd bash
root@sonic:/# ps -aux | grep [s]yncd
root        23  5.1  2.5 1265152 207064 pts/0  Sl   13:15   0:04 /usr/bin/syncd -u -p /tmp/sai.profile -t cold -r -m /usr/share/sonic/hwsku/port_config.ini

Additional information you deem important (e.g. issue happens only occasionally):

  • N/A

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions