Skip to content

Commit 3a2b8c6

Browse files
[SONiC Application Extension] support warm/fast reboot for extension packages (#7286)
#### Why I did it I made this change to support warm/fast reboot for SONiC extension packages as per HLD sonic-net/SONiC#682. #### How I did it I extended manifest.json.j2 with new warm/fast reboot related fields and also extended sonic_debian_extension.j2 script template to generate the shutdown order files for warm and fast reboot.
1 parent 447f09f commit 3a2b8c6

11 files changed

Lines changed: 40 additions & 1 deletion

File tree

files/build_templates/manifest.json.j2

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@
1212
"before": {{ before.split()|json if before is defined else [] }},
1313
"dependent-of": {{ dependent_of.split()|json if dependent_of is defined else [] }},
1414
"asic-service": {{ asic_service }},
15-
"host-service": {{ host_service }}
15+
"host-service": {{ host_service }},
16+
"warm-shutdown": {
17+
"after": {{ warm_shutdown_after.split()|json if warm_shutdown_after is defined else [] }},
18+
"before": {{ warm_shutdown_before.split()|json if warm_shutdown_before is defined else [] }}
19+
},
20+
"fast-shutdown": {
21+
"after": {{ fast_shutdown_after.split()|json if fast_shutdown_after is defined else [] }},
22+
"before": {{ fast_shutdown_before.split()|json if fast_shutdown_before is defined else [] }}
23+
}
1624
},
1725
"container": {
1826
"privileged": {{ privileged if privileged else 'false' }},

files/build_templates/sonic_debian_extension.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,9 @@ fi
676676
# Copy docker_image_ctl.j2 for SONiC Package Manager
677677
sudo cp $BUILD_TEMPLATES/docker_image_ctl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/docker_image_ctl.j2
678678

679+
# Generate shutdown order
680+
sudo LANG=C chroot $FILESYSTEM_ROOT /usr/local/bin/generate_shutdown_order.py
681+
679682
{% if include_kubernetes == "y" %}
680683
## Pull in kubernetes docker images
681684
echo "pulling universal k8s images ..."

files/image_config/warmboot-finalizer/finalize-warmboot.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ declare -A RECONCILE_COMPONENTS=( \
1111
["bgp"]="bgp" \
1212
["nat"]="natsyncd" \
1313
)
14+
15+
for reconcile_file in $(find /etc/sonic/ -iname '*_reconcile' -type f); do
16+
file_basename=$(basename $reconcile_file)
17+
docker_container_name=${file_basename%_reconcile}
18+
RECONCILE_COMPONENTS[$docker_container_name]=$(cat $reconcile_file)
19+
done
20+
1421
EXP_STATE="reconciled"
1522

1623
ASSISTANT_SCRIPT="/usr/local/bin/neighbor_advertiser"

rules/docker-fpm-frr.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1818

1919
$(DOCKER_FPM_FRR)_VERSION = 1.0.0
2020
$(DOCKER_FPM_FRR)_PACKAGE_NAME = fpm-frr
21+
$(DOCKER_FPM_FRR)_WARM_SHUTDOWN_BEFORE = swss
22+
$(DOCKER_FPM_FRR)_WARM_SHUTDOWN_AFTER = radv
23+
$(DOCKER_FPM_FRR)_FAST_SHUTDOWN_BEFORE = swss
24+
$(DOCKER_FPM_FRR)_FAST_SHUTDOWN_AFTER = radv
2125

2226
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
2327

rules/docker-lldp.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ $(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1818

1919
$(DOCKER_LLDP)_VERSION = 1.0.0
2020
$(DOCKER_LLDP)_PACKAGE_NAME = lldp
21+
$(DOCKER_LLDP)_WARM_SHUTDOWN_BEFORE = swss
22+
$(DOCKER_LLDP)_FAST_SHUTDOWN_BEFORE = swss
2123

2224
SONIC_DOCKER_IMAGES += $(DOCKER_LLDP)
2325
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP)

rules/docker-nat.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ $(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1515

1616
$(DOCKER_NAT)_VERSION = 1.0.0
1717
$(DOCKER_NAT)_PACKAGE_NAME = nat
18+
$(DOCKER_NAT)_WARM_SHUTDOWN_BEFORE = swss
19+
$(DOCKER_NAT)_FAST_SHUTDOWN_BEFORE = swss
1820

1921
ifeq ($(INCLUDE_NAT), y)
2022
SONIC_DOCKER_IMAGES += $(DOCKER_NAT)

rules/docker-orchagent.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ $(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1919

2020
$(DOCKER_ORCHAGENT)_VERSION = 1.0.0
2121
$(DOCKER_ORCHAGENT)_PACKAGE_NAME = swss
22+
$(DOCKER_ORCHAGENT)_WARM_SHUTDOWN_BEFORE = syncd
23+
$(DOCKER_ORCHAGENT)_FAST_SHUTDOWN_BEFORE = syncd
2224

2325
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT)
2426
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT)

rules/docker-router-advertiser.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER)
1515

1616
$(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0
1717
$(DOCKER_ROUTER_ADVERTISER)_PACKAGE_NAME = radv
18+
$(DOCKER_ROUTER_ADVERTISER)_WARM_SHUTDOWN_BEFORE = swss
19+
$(DOCKER_ROUTER_ADVERTISER)_FAST_SHUTDOWN_BEFORE = swss
1820

1921
SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER)
2022
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER)

rules/docker-sflow.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ $(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1515

1616
$(DOCKER_SFLOW)_VERSION = 1.0.0
1717
$(DOCKER_SFLOW)_PACKAGE_NAME = sflow
18+
$(DOCKER_SFLOW)_WARM_SHUTDOWN_BEFORE = swss
19+
$(DOCKER_SFLOW)_FAST_SHUTDOWN_BEFORE = swss
1820

1921
SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW)
2022
ifeq ($(INCLUDE_SFLOW), y)

rules/docker-teamd.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)
1717

1818
$(DOCKER_TEAMD)_VERSION = 1.0.0
1919
$(DOCKER_TEAMD)_PACKAGE_NAME = teamd
20+
$(DOCKER_TEAMD)_WARM_SHUTDOWN_BEFORE = syncd
21+
$(DOCKER_TEAMD)_WARM_SHUTDOWN_AFTER = swss
22+
$(DOCKER_TEAMD)_FAST_SHUTDOWN_BEFORE = swss
2023

2124
SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD)
2225
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD)

0 commit comments

Comments
 (0)