From 6961816dec1435a48bb411c72c8309bb354b1624 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Wed, 26 Jun 2019 22:46:58 +0300 Subject: [PATCH] fix fast reboot compatibility (#3083) * fix fast reboot compatibility We should handle both cases for backward-compatible with 201803: - fast-reboot - SONIC_BOOT_TYPE=fast-reboot * handle review comments * add a comment that getBootType code snippet is shared between two files --- files/build_templates/docker_image_ctl.j2 | 12 ++++++------ files/scripts/syncd.sh | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 881d562de901..f6f46aa49aa0 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -33,15 +33,15 @@ function updateHostName() function getBootType() { - local BOOT_TYPE - case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in - warm*) + # same code snippet in files/scripts/syncd.sh + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) TYPE='warm' ;; - fastfast) + *SONIC_BOOT_TYPE=fastfast*) TYPE='fastfast' ;; - fast*) + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) TYPE='fast' ;; *) @@ -167,7 +167,7 @@ start() { echo "Creating new {{docker_container_name}} container with HWSKU $HWSKU" {%- endif %} {%- if sonic_asic_platform == "mellanox" %} - # TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version + # TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version {%- endif %} docker create {{docker_image_run_opt}} \ {%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %} diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 04f407ebbcc8..d4536b4d8b94 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -55,14 +55,15 @@ function wait_for_database_service() function getBootType() { - case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in - warm*) + # same code snippet in files/build_templates/docker_image_ctl.j2 + case "$(cat /proc/cmdline)" in + *SONIC_BOOT_TYPE=warm*) TYPE='warm' ;; - fastfast) + *SONIC_BOOT_TYPE=fastfast*) TYPE='fastfast' ;; - fast*) + *SONIC_BOOT_TYPE=fast*|*fast-reboot*) TYPE='fast' ;; *)