Skip to content

Commit 1848fb2

Browse files
pavel-shirshovlguohan
authored andcommitted
[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.
1 parent d5aa0d4 commit 1848fb2

File tree

8 files changed

+22
-27
lines changed

8 files changed

+22
-27
lines changed

dockers/docker-base-stretch/Dockerfile.j2

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ RUN apt-get update && \
4747
vim-tiny \
4848
# Install dependencies of supervisor
4949
python-pkg-resources \
50-
python-meld3
50+
python-meld3 \
51+
# dependencies of redis-tools
52+
libatomic1 \
53+
libjemalloc1 \
54+
liblua5.1-0 \
55+
lua-bitop \
56+
lua-cjson
5157

5258
{% if CONFIGURED_ARCH == "armhf" %}
5359
# ip and ifconfig utility missing in docker for armhf

dockers/docker-orchagent/Dockerfile.j2

-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ RUN apt-get update && \
1818
iproute2 \
1919
ndisc6 \
2020
tcpdump \
21-
# Install redis-tools dependencies
22-
# TODO: implicitly install dependencies
23-
libatomic1 \
24-
libjemalloc1 \
25-
liblua5.1-0 \
26-
lua-bitop \
27-
lua-cjson \
2821
libelf1 \
2922
libmnl0 \
3023
bridge-utils

dockers/docker-sonic-telemetry/Dockerfile.j2

+1-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ RUN apt-get update && \
1111
apt-get install -f -y \
1212
libdbus-1-3 \
1313
libdaemon0 \
14-
libjansson4 \
15-
# Install redis-tools dependencies
16-
# TODO: implicitly install dependencies
17-
libatomic1 \
18-
libjemalloc1 \
19-
liblua5.1-0 \
20-
lua-bitop \
21-
lua-cjson
14+
libjansson4
2215

2316
{% if docker_sonic_telemetry_debs.strip() -%}
2417
# Copy locally-built Debian package dependencies

dockers/docker-teamd/Dockerfile.j2

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ RUN apt-get update && \
1212
libdbus-1-3 \
1313
libdaemon0 \
1414
libjansson4 \
15-
libpython2.7 \
16-
# Install redis-tools dependencies
17-
# TODO: implicitly install dependencies
18-
libatomic1 \
19-
libjemalloc1 \
20-
liblua5.1-0 \
21-
lua-bitop \
22-
lua-cjson
15+
libpython2.7
2316

2417
{% if docker_teamd_debs.strip() -%}
2518
# Copy locally-built Debian package dependencies

files/build_templates/docker_image_ctl.j2

+5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ function postStartAction()
149149
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
150150
fi
151151

152+
if [[ "$BOOT_TYPE" == "fast" ]]; then
153+
# set the key to expire in 3 minutes
154+
redis-cli -n 6 SET "FAST_REBOOT|system" "1" "EX" "180"
155+
fi
156+
152157
redis-cli -n 4 SET "CONFIG_DB_INITIALIZED" "1"
153158
fi
154159

files/scripts/syncd.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ function getBootType()
6464
TYPE='fastfast'
6565
;;
6666
*SONIC_BOOT_TYPE=fast*|*fast-reboot*)
67-
TYPE=$(awk '{ if ($1 <= 180) print "fast"; else print "cold" }' /proc/uptime)
67+
# check that the key exists
68+
if [[ $(redis-cli -n 6 GET "FAST_REBOOT|system") == "1" ]]; then
69+
TYPE='fast'
70+
else
71+
TYPE='cold'
72+
fi
6873
;;
6974
*)
7075
TYPE='cold'

rules/docker-base-stretch.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
DOCKER_BASE_STRETCH = docker-base-stretch.gz
44
$(DOCKER_BASE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-base-stretch
5-
$(DOCKER_BASE_STRETCH)_DEPENDS += $(SUPERVISOR)
5+
$(DOCKER_BASE_STRETCH)_DEPENDS += $(SUPERVISOR) $(REDIS_TOOLS)
66
$(DOCKER_BASE_STRETCH)_DEPENDS += $(SOCAT)
77

88
GDB = gdb

src/sonic-quagga

0 commit comments

Comments
 (0)