Skip to content

Commit

Permalink
[SONiC Application Extension] support warm/fast reboot for extension …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
stepanblyschak authored and judyjoseph committed Aug 7, 2021
1 parent 790bdde commit a10f1f2
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 1 deletion.
10 changes: 9 additions & 1 deletion files/build_templates/manifest.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
"before": {{ before.split()|json if before is defined else [] }},
"dependent-of": {{ dependent_of.split()|json if dependent_of is defined else [] }},
"asic-service": {{ asic_service }},
"host-service": {{ host_service }}
"host-service": {{ host_service }},
"warm-shutdown": {
"after": {{ warm_shutdown_after.split()|json if warm_shutdown_after is defined else [] }},
"before": {{ warm_shutdown_before.split()|json if warm_shutdown_before is defined else [] }}
},
"fast-shutdown": {
"after": {{ fast_shutdown_after.split()|json if fast_shutdown_after is defined else [] }},
"before": {{ fast_shutdown_before.split()|json if fast_shutdown_before is defined else [] }}
}
},
"container": {
"privileged": {{ privileged if privileged else 'false' }},
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ fi
# Copy docker_image_ctl.j2 for SONiC Package Manager
sudo cp $BUILD_TEMPLATES/docker_image_ctl.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/docker_image_ctl.j2

# Generate shutdown order
sudo LANG=C chroot $FILESYSTEM_ROOT /usr/local/bin/generate_shutdown_order.py

{% if include_kubernetes == "y" %}
## Pull in kubernetes docker images
echo "pulling universal k8s images ..."
Expand Down
7 changes: 7 additions & 0 deletions files/image_config/warmboot-finalizer/finalize-warmboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ declare -A RECONCILE_COMPONENTS=( \
["bgp"]="bgp" \
["nat"]="natsyncd" \
)

for reconcile_file in $(find /etc/sonic/ -iname '*_reconcile' -type f); do
file_basename=$(basename $reconcile_file)
docker_container_name=${file_basename%_reconcile}
RECONCILE_COMPONENTS[$docker_container_name]=$(cat $reconcile_file)
done

EXP_STATE="reconciled"

ASSISTANT_SCRIPT="/usr/local/bin/neighbor_advertiser"
Expand Down
4 changes: 4 additions & 0 deletions rules/docker-fpm-frr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_FPM_FRR)_VERSION = 1.0.0
$(DOCKER_FPM_FRR)_PACKAGE_NAME = fpm-frr
$(DOCKER_FPM_FRR)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_FPM_FRR)_WARM_SHUTDOWN_AFTER = radv
$(DOCKER_FPM_FRR)_FAST_SHUTDOWN_BEFORE = swss
$(DOCKER_FPM_FRR)_FAST_SHUTDOWN_AFTER = radv

SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)

Expand Down
2 changes: 2 additions & 0 deletions rules/docker-lldp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ $(DOCKER_LLDP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_LLDP)_VERSION = 1.0.0
$(DOCKER_LLDP)_PACKAGE_NAME = lldp
$(DOCKER_LLDP)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_LLDP)_FAST_SHUTDOWN_BEFORE = swss

SONIC_DOCKER_IMAGES += $(DOCKER_LLDP)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-nat.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ $(DOCKER_NAT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_NAT)_VERSION = 1.0.0
$(DOCKER_NAT)_PACKAGE_NAME = nat
$(DOCKER_NAT)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_NAT)_FAST_SHUTDOWN_BEFORE = swss

ifeq ($(INCLUDE_NAT), y)
SONIC_DOCKER_IMAGES += $(DOCKER_NAT)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-orchagent.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ $(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_ORCHAGENT)_VERSION = 1.0.0
$(DOCKER_ORCHAGENT)_PACKAGE_NAME = swss
$(DOCKER_ORCHAGENT)_WARM_SHUTDOWN_BEFORE = syncd
$(DOCKER_ORCHAGENT)_FAST_SHUTDOWN_BEFORE = syncd

SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-router-advertiser.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ $(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_ROUTER_ADVERTISER)_VERSION = 1.0.0
$(DOCKER_ROUTER_ADVERTISER)_PACKAGE_NAME = radv
$(DOCKER_ROUTER_ADVERTISER)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_ROUTER_ADVERTISER)_FAST_SHUTDOWN_BEFORE = swss

SONIC_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ROUTER_ADVERTISER)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-sflow.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ $(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_SFLOW)_VERSION = 1.0.0
$(DOCKER_SFLOW)_PACKAGE_NAME = sflow
$(DOCKER_SFLOW)_WARM_SHUTDOWN_BEFORE = swss
$(DOCKER_SFLOW)_FAST_SHUTDOWN_BEFORE = swss

SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW)
ifeq ($(INCLUDE_SFLOW), y)
Expand Down
3 changes: 3 additions & 0 deletions rules/docker-teamd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ $(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BUSTER)

$(DOCKER_TEAMD)_VERSION = 1.0.0
$(DOCKER_TEAMD)_PACKAGE_NAME = teamd
$(DOCKER_TEAMD)_WARM_SHUTDOWN_BEFORE = syncd
$(DOCKER_TEAMD)_WARM_SHUTDOWN_AFTER = swss
$(DOCKER_TEAMD)_FAST_SHUTDOWN_BEFORE = swss

SONIC_DOCKER_IMAGES += $(DOCKER_TEAMD)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_TEAMD)
Expand Down
4 changes: 4 additions & 0 deletions rules/functions
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ define generate_manifest
$(eval export after=$($(1).gz_SERVICE_AFTER))
$(eval export before=$($(1).gz_SERVICE_BEFORE))
$(eval export dependent_of=$($(1).gz_SERVICE_DEPENDENT_OF))
$(eval export warm_shutdown_after=$($*.gz_WARM_SHUTDOWN_AFTER))
$(eval export warm_shutdown_before=$($*.gz_WARM_SHUTDOWN_BEFORE))
$(eval export fast_shutdown_after=$($*.gz_FAST_SHUTDOWN_AFTER))
$(eval export fast_shutdown_before=$($*.gz_FAST_SHUTDOWN_BEFORE))
$(eval export privileged=$($(1).gz_CONTAINER_PRIVILEGED))
$(eval export volumes=$($(1).gz_CONTAINER_VOLUMES))
$(eval export tmpfs=$($(1).gz_CONTAINER_TMPFS))
Expand Down

0 comments on commit a10f1f2

Please sign in to comment.