[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 Azure/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.
This commit is contained in:
Stepan Blyshchak 2021-07-11 16:58:05 +03:00 committed by Judy Joseph
parent 790bdded96
commit a10f1f22de
11 changed files with 40 additions and 1 deletions

View File

@ -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' }},

View File

@ -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 ..."

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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))