[config reload]Config Reload Enhancement (#13969)
#### Why I did it Implementing code changes for https://github.com/sonic-net/SONiC/pull/1203 #### How I did it Removed the timers and delayed target since the delayed services would start based on event driven approach. Cleared port table during config reload and cold reboot scenario. Modified yang model, init_cfg.json to change has_timer to delayed #### How to verify it Running regression
This commit is contained in:
parent
97c29a45bd
commit
2804998766
@ -55,11 +55,11 @@
|
||||
{%- if include_macsec == "y" %}{% do features.append(("macsec", "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}{% endif %}
|
||||
{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
|
||||
"FEATURE": {
|
||||
{# has_timer field if set, will start the feature systemd .timer unit instead of .service unit #}
|
||||
{%- for feature, state, has_timer, autorestart in features %}
|
||||
{# delayed field if set, will start the feature systemd .timer unit instead of .service unit #}
|
||||
{%- for feature, state, delayed, autorestart in features %}
|
||||
"{{feature}}": {
|
||||
"state": "{{state}}",
|
||||
"has_timer" : {{has_timer | lower()}},
|
||||
"delayed" : {{delayed | lower()}},
|
||||
"has_global_scope": {% if feature + '.service' in installer_services.split(' ') %}true{% else %}false{% endif %},
|
||||
{%- if feature in ["lldp"] %}
|
||||
"has_per_asic_scope": {% raw %}"{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}"{% endraw %},
|
||||
|
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Delays management framework container until SONiC has started
|
||||
PartOf=mgmt-framework.service
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=0 sec
|
||||
OnBootSec=3min 30 sec
|
||||
Unit=mgmt-framework.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target sonic.target sonic-delayed.target
|
@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
# This delay is for fast/warm reboot performance
|
||||
Description=Delays LLDP docker until SONiC has started
|
||||
PartOf=lldp{% if multi_instance == 'true' %}@%i{% endif %}.service
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=0 sec
|
||||
OnBootSec=1min 30 sec
|
||||
Unit=lldp{% if multi_instance == 'true' %}@%i{% endif %}.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target sonic.target sonic-delayed.target
|
@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
# This delay is for fast/warm reboot performance
|
||||
Description=Delays pmon docker until SONiC has started
|
||||
PartOf=pmon.service
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=0 sec
|
||||
OnBootSec=1min 30 sec
|
||||
Unit=pmon.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target sonic.target sonic-delayed.target
|
@ -2,7 +2,7 @@
|
||||
Description=SNMP container
|
||||
Requires=updategraph.service
|
||||
Requisite=swss.service
|
||||
After=updategraph.service swss.service syncd.service
|
||||
After=updategraph.service swss.service syncd.service interfaces-config.service
|
||||
BindsTo=sonic.target
|
||||
After=sonic.target
|
||||
Before=ntp-config.service
|
||||
|
@ -1,12 +0,0 @@
|
||||
[Unit]
|
||||
Description=Delays snmp container until SONiC has started
|
||||
PartOf=snmp.service
|
||||
After=swss.service interfaces-config.service
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=0 sec
|
||||
OnBootSec=3min 30 sec
|
||||
Unit=snmp.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target swss.service sonic-delayed.target
|
@ -1,5 +0,0 @@
|
||||
[Unit]
|
||||
Description=SONiC delayed services target.
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -852,19 +852,6 @@ if [ -f {{service}} ]; then
|
||||
echo "{{service}}" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
fi
|
||||
{% endfor %}
|
||||
{% for timer in installer_timers.split(' ') -%}
|
||||
if [ -f {{timer}} ]; then
|
||||
sudo cp {{timer}} $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
|
||||
{% if "@" in timer %}
|
||||
MULTI_INSTANCE="{{timer}}"
|
||||
SINGLE_INSTANCE=${MULTI_INSTANCE/"@"}
|
||||
sudo cp $SINGLE_INSTANCE $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
{% endif %}
|
||||
|
||||
echo "{{timer}}" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
fi
|
||||
{% endfor %}
|
||||
if [ -f iccpd.service ]; then
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl disable iccpd.service
|
||||
fi
|
||||
@ -898,30 +885,9 @@ sudo LANG=C cp $SCRIPTS_DIR/write_standby.py $FILESYSTEM_ROOT/usr/local/bin/writ
|
||||
# Copy mark_dhcp_packet script
|
||||
sudo LANG=C cp $SCRIPTS_DIR/mark_dhcp_packet.py $FILESYSTEM_ROOT/usr/local/bin/mark_dhcp_packet.py
|
||||
|
||||
# Copy systemd timer configuration
|
||||
# It implements delayed start of services
|
||||
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
echo "snmp.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
|
||||
{% if include_system_telemetry == 'y' %}
|
||||
sudo cp $BUILD_TEMPLATES/telemetry.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
echo "telemetry.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
{% endif %}
|
||||
|
||||
{% if include_mgmt_framework == 'y' %}
|
||||
sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
{% endif %}
|
||||
|
||||
sudo cp $BUILD_TEMPLATES/pmon.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
echo "pmon.timer" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
|
||||
sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target
|
||||
|
||||
sudo cp $BUILD_TEMPLATES/sonic-delayed.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic-delayed.target
|
||||
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python3-dev
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y libcairo2-dev libdbus-1-dev libgirepository1.0-dev libsystemd-dev pkg-config
|
||||
|
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Delays telemetry container until SONiC has started
|
||||
PartOf=telemetry.service
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=0 sec
|
||||
OnBootSec=3min 30 sec
|
||||
Unit=telemetry.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target sonic.target sonic-delayed.target
|
@ -275,6 +275,8 @@ stop() {
|
||||
if [[ x"$WARM_BOOT" != x"true" ]] && [[ x"$FAST_BOOT" != x"true" ]]; then
|
||||
/usr/bin/${SERVICE}.sh stop $DEV
|
||||
debug "Stopped ${SERVICE}$DEV service..."
|
||||
$SONIC_DB_CLI APPL_DB DEL PORT_TABLE:PortInitDone
|
||||
debug "Cleared PortInitDone from APPL_DB..."
|
||||
else
|
||||
debug "Killing Docker swss..."
|
||||
/usr/bin/docker kill swss &> /dev/null || debug "Docker swss is not running ($?) ..."
|
||||
|
31
slave.mk
31
slave.mk
@ -1343,14 +1343,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
$(eval $(docker:-dbg.gz=.gz)_GLOBAL = yes)
|
||||
)
|
||||
fi
|
||||
if [ -f files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then
|
||||
j2 files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer
|
||||
|
||||
# Set the flag GLOBAL_TIMER for all the global system-wide dockers timers.
|
||||
$(if $(shell ls files/build_templates/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\
|
||||
$(eval $(docker:-dbg.gz=.gz)_GLOBAL_TIMER = yes)
|
||||
)
|
||||
fi
|
||||
# Any service template, inside instance directory, will be used to generate .service and @.service file.
|
||||
if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then
|
||||
export multi_instance="true"
|
||||
@ -1361,16 +1353,6 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
export multi_instance="false"
|
||||
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service
|
||||
fi
|
||||
# Any timer template, inside instance directory, will be used to generate .timer and @.timer file.
|
||||
if [ -f files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 ]; then
|
||||
export multi_instance="true"
|
||||
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME)@.timer
|
||||
$(if $(shell ls files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 2>/dev/null),\
|
||||
$(eval $(docker:-dbg.gz=.gz)_TEMPLATE_TIMER = yes)
|
||||
)
|
||||
export multi_instance="false"
|
||||
j2 files/build_templates/per_namespace/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer.j2 > $($(docker:-dbg.gz=.gz)_CONTAINER_NAME).timer
|
||||
fi
|
||||
# Any service template, inside share_image directory, will be used to generate -chassis.service file.
|
||||
# TODO: need better way to name the image-shared service
|
||||
if [ -f files/build_templates/share_image/$($(docker:-dbg.gz=.gz)_CONTAINER_NAME).service.j2 ]; then
|
||||
@ -1407,20 +1389,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
$(eval SERVICES += "$(addsuffix -chassis.service, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")
|
||||
)
|
||||
)
|
||||
# Marks template timers with an "@" according to systemd convention
|
||||
# If the $($docker)_TEMPLATE_TIMER) variable is set, the timer will be treated as a template
|
||||
# If the $($docker)_GLOBAL_TIMER) and $($docker)_TEMPLATE_TIMER) variables are set the timer will be added both as a global and template timer.
|
||||
$(foreach docker, $($*_DOCKERS),\
|
||||
$(if $($(docker:-dbg.gz=.gz)_TEMPLATE_TIMER),\
|
||||
$(if $($(docker:-dbg.gz=.gz)_GLOBAL_TIMER),\
|
||||
$(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")\
|
||||
)\
|
||||
$(eval TIMERS += "$(addsuffix @.timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))"),\
|
||||
$(eval TIMERS += "$(addsuffix .timer, $($(docker:-dbg.gz=.gz)_CONTAINER_NAME))")
|
||||
)
|
||||
)
|
||||
export installer_services="$(SERVICES)"
|
||||
export installer_timers="$(TIMERS)"
|
||||
|
||||
export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker:-dbg.gz=.gz)_BASE_IMAGE_FILES), $($(docker:-dbg.gz=.gz)_PATH)/base_image_files/$(file)))"
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2fdb64b49f9597d39d09a230bc57b02e735882aa
|
||||
Subproject commit b08e9400ff7edf50620dda79c4d9f8634e89008c
|
@ -1 +1 @@
|
||||
Subproject commit ff032fe2102129069cfe4a263c8ba07f515dec18
|
||||
Subproject commit a1057b279233f484be550ee36bd4d4677794a407
|
@ -1735,7 +1735,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "False",
|
||||
"has_per_asic_scope": "True",
|
||||
"has_timer": "False",
|
||||
"delayed": "False",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
@ -1746,7 +1746,7 @@
|
||||
"auto_restart": "always_enabled",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "always_enabled",
|
||||
"set_owner": "local",
|
||||
@ -1757,7 +1757,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "false",
|
||||
"has_timer": "true",
|
||||
"delayed": "true",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "kube",
|
||||
@ -1768,7 +1768,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
@ -1779,7 +1779,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "local",
|
||||
@ -1790,7 +1790,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "enabled",
|
||||
"set_owner": "kube",
|
||||
@ -1801,7 +1801,7 @@
|
||||
"auto_restart": "enabled",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"high_mem_alert": "disabled",
|
||||
"state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}",
|
||||
"set_owner": "kube",
|
||||
|
@ -7,7 +7,7 @@
|
||||
"name": "database",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "False",
|
||||
"delayed": "False",
|
||||
"has_global_scope": "True",
|
||||
"has_per_asic_scope": "True",
|
||||
"set_owner": "local",
|
||||
@ -18,7 +18,7 @@
|
||||
"name": "swss",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "local",
|
||||
@ -29,7 +29,7 @@
|
||||
"name": "syncd",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "local",
|
||||
@ -40,7 +40,7 @@
|
||||
"name": "snmp",
|
||||
"state": "enabled",
|
||||
"auto_restart": "enabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "true",
|
||||
"has_per_asic_scope": "false",
|
||||
"set_owner": "kube",
|
||||
@ -51,7 +51,7 @@
|
||||
"name": "lldp",
|
||||
"state": "disabled",
|
||||
"auto_restart": "disabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"set_owner": "kube",
|
||||
@ -62,7 +62,7 @@
|
||||
"name": "dhcp_relay",
|
||||
"state": "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] != 'ToRRouter') %}enabled{% else %}disabled{% endif %}",
|
||||
"auto_restart": "disabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "true",
|
||||
"set_owner": "kube",
|
||||
@ -81,7 +81,7 @@
|
||||
"name": "lldp",
|
||||
"state": "disabled",
|
||||
"auto_restart": "disabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"set_owner": "invalid",
|
||||
@ -100,7 +100,7 @@
|
||||
"name": "lldp",
|
||||
"state": "disabled",
|
||||
"auto_restart": "disabled",
|
||||
"has_timer": "false",
|
||||
"delayed": "false",
|
||||
"has_global_scope": "false",
|
||||
"has_per_asic_scope": "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] or ('CHASSIS_METADATA' in DEVICE_RUNTIME_METADATA and DEVICE_RUNTIME_METADATA['CHASSIS_METADATA']['module_type'] in ['supervisor']) %}False{% else %}True{% endif %}",
|
||||
"check_up_status": "false",
|
||||
@ -119,7 +119,7 @@
|
||||
"name": "database",
|
||||
"state": "always_enabled",
|
||||
"auto_restart": "always_enabled",
|
||||
"has_timer": "FALSE",
|
||||
"delayed": "FALSE",
|
||||
"has_global_scope": "TRUE",
|
||||
"has_per_asic_scope": "TRUE",
|
||||
"check_up_status": "FALSE",
|
||||
|
@ -57,9 +57,9 @@ module sonic-feature{
|
||||
default "enabled";
|
||||
}
|
||||
|
||||
leaf has_timer {
|
||||
description "This configuration identicates if there is
|
||||
timer associated to this feature";
|
||||
leaf delayed {
|
||||
description "This configuration identicates if the feature needs to be delayed until
|
||||
system initialization";
|
||||
type stypes:boolean_type;
|
||||
default "false";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user