From 3f049d33bf2c9f792f4cebd5d24dd9010a3562c0 Mon Sep 17 00:00:00 2001 From: Jipan Yang Date: Fri, 7 Sep 2018 12:25:38 -0700 Subject: [PATCH] =?UTF-8?q?Warm=20reboot:=20Don't=20load=20json=20conifg?= =?UTF-8?q?=20like=20copp,=20ininip,=20ports=20and=20switch=20again=20upon?= =?UTF-8?q?=E2=80=A6=20(#1939)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don't load json conifg like copp, ininip, ports and switch again upon swss warm start Signed-off-by: Jipan Yang * double check DB data exists in case only swss warm restart is configured at system reboot Signed-off-by: Jipan Yang * Double check existence of db data before skipping json load, and format update Signed-off-by: Jipan Yang --- dockers/docker-orchagent/swssconfig.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dockers/docker-orchagent/swssconfig.sh b/dockers/docker-orchagent/swssconfig.sh index 850a4afd1e..7188703d23 100755 --- a/dockers/docker-orchagent/swssconfig.sh +++ b/dockers/docker-orchagent/swssconfig.sh @@ -41,6 +41,18 @@ fast_reboot HWSKU=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"` +# Don't load json config if system warm start or +# swss docker warm start is enabled, the data already exists in appDB. +SYSTEM_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|system" enable` +SWSS_WARM_START=`redis-cli -n 4 hget "WARM_RESTART|swss" enable` +if [[ "$SYSTEM_WARM_START" == "true" ]] || [[ "$SWSS_WARM_START" == "true" ]]; then + # We have to make sure db data has not been flushed. + RESTART_COUNT=`redis-cli -n 6 hget "WARM_RESTART_TABLE|orchagent" restart_count` + if [[ -n "$RESTART_COUNT" ]] && [[ "$RESTART_COUNT" != "0" ]]; then + exit 0 + fi +fi + SWSSCONFIG_ARGS="00-copp.config.json ipinip.json ports.json switch.json " for file in $SWSSCONFIG_ARGS; do