[fast-reboot]: Save fast-reboot state into the db (#3741)

Put a flag for fast-reboot to the db using EXPIRE feature. Using this flag in other part of SONiC to start in Fast-reboot mode. If we reload a config, the state in the db will be removed.
This commit is contained in:
pavel-shirshov 2019-12-04 14:10:19 -08:00 committed by Abhishek
parent d688c267b5
commit 74b45be487
8 changed files with 22 additions and 27 deletions

View File

@ -47,7 +47,13 @@ RUN apt-get update && \
vim-tiny \ vim-tiny \
# Install dependencies of supervisor # Install dependencies of supervisor
python-pkg-resources \ python-pkg-resources \
python-meld3 python-meld3 \
# dependencies of redis-tools
libatomic1 \
libjemalloc1 \
liblua5.1-0 \
lua-bitop \
lua-cjson
{% if CONFIGURED_ARCH == "armhf" %} {% if CONFIGURED_ARCH == "armhf" %}
# ip and ifconfig utility missing in docker for armhf # ip and ifconfig utility missing in docker for armhf

View File

@ -18,13 +18,6 @@ RUN apt-get update && \
iproute2 \ iproute2 \
ndisc6 \ ndisc6 \
tcpdump \ tcpdump \
# Install redis-tools dependencies
# TODO: implicitly install dependencies
libatomic1 \
libjemalloc1 \
liblua5.1-0 \
lua-bitop \
lua-cjson \
libelf1 \ libelf1 \
libmnl0 \ libmnl0 \
bridge-utils bridge-utils

View File

@ -11,14 +11,7 @@ RUN apt-get update && \
apt-get install -f -y \ apt-get install -f -y \
libdbus-1-3 \ libdbus-1-3 \
libdaemon0 \ libdaemon0 \
libjansson4 \ libjansson4
# Install redis-tools dependencies
# TODO: implicitly install dependencies
libatomic1 \
libjemalloc1 \
liblua5.1-0 \
lua-bitop \
lua-cjson
{% if docker_sonic_telemetry_debs.strip() -%} {% if docker_sonic_telemetry_debs.strip() -%}
# Copy locally-built Debian package dependencies # Copy locally-built Debian package dependencies

View File

@ -12,14 +12,7 @@ RUN apt-get update && \
libdbus-1-3 \ libdbus-1-3 \
libdaemon0 \ libdaemon0 \
libjansson4 \ libjansson4 \
libpython2.7 \ libpython2.7
# Install redis-tools dependencies
# TODO: implicitly install dependencies
libatomic1 \
libjemalloc1 \
liblua5.1-0 \
lua-bitop \
lua-cjson
{% if docker_teamd_debs.strip() -%} {% if docker_teamd_debs.strip() -%}
# Copy locally-built Debian package dependencies # Copy locally-built Debian package dependencies

View File

@ -149,6 +149,11 @@ function postStartAction()
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
fi fi
if [[ "$BOOT_TYPE" == "fast" ]]; then
# set the key to expire in 3 minutes
redis-cli -n 6 SET "FAST_REBOOT|system" "1" "EX" "180"
fi
redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1" redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1"
fi fi

View File

@ -64,7 +64,12 @@ function getBootType()
TYPE='fastfast' TYPE='fastfast'
;; ;;
*SONIC_BOOT_TYPE=fast*|*fast-reboot*) *SONIC_BOOT_TYPE=fast*|*fast-reboot*)
TYPE=$(awk '{ if ($1 <= 180) print "fast"; else print "cold" }' /proc/uptime) # check that the key exists
if [[ $(redis-cli -n 6 GET "FAST_REBOOT|system") == "1" ]]; then
TYPE='fast'
else
TYPE='cold'
fi
;; ;;
*) *)
TYPE='cold' TYPE='cold'

View File

@ -2,7 +2,7 @@
DOCKER_BASE_STRETCH = docker-base-stretch.gz DOCKER_BASE_STRETCH = docker-base-stretch.gz
$(DOCKER_BASE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-base-stretch $(DOCKER_BASE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-base-stretch
$(DOCKER_BASE_STRETCH)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE_STRETCH)_DEPENDS += $(SUPERVISOR) $(REDIS_TOOLS)
$(DOCKER_BASE_STRETCH)_DEPENDS += $(SOCAT) $(DOCKER_BASE_STRETCH)_DEPENDS += $(SOCAT)
GDB = gdb GDB = gdb

@ -1 +1 @@
Subproject commit 904a350107793d44be7167500fcec9087ca3243b Subproject commit 7101eeda1a1ccef2e951e4bea5a2f15d9a43e3b5