Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warm reboot: Separate syncd from swss systemd service #1876

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 3 additions & 43 deletions files/build_templates/swss.service.j2
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
[Unit]
Description=switch state service
Requires=database.service updategraph.service
{% if sonic_asic_platform == 'broadcom' %}
Requires=opennsl-modules-3.16.0-5-amd64.service
{% elif sonic_asic_platform == 'nephos' %}
Requires=nps-modules-3.16.0-5-amd64.service
{% endif %}
After=database.service updategraph.service
Requires=syncd.service
After=syncd.service
After=interfaces-config.service
{% if sonic_asic_platform == 'broadcom' %}
After=opennsl-modules-3.16.0-5-amd64.service
{% elif sonic_asic_platform == 'nephos' %}
After=nps-modules-3.16.0-5-amd64.service
{% endif %}

[Service]
User=root
# Wait for redis server start before database clean
ExecStartPre=/bin/bash -c 'until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do sleep 1; done'
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 5 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 6 FLUSHDB

{% if sonic_asic_platform == 'mellanox' %}
Environment=FAST_BOOT=1
TimeoutStartSec=3min
ExecStartPre=/usr/bin/mst start
ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh
ExecStartPre=/etc/init.d/sxdkernel start
ExecStartPre=/sbin/modprobe i2c-dev
ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management start"
{% elif sonic_asic_platform == 'cavium' %}
ExecStartPre=/etc/init.d/xpnet.sh start
{% endif %}

ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStartPre=/usr/bin/syncd.sh start
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh attach

ExecStop=/usr/bin/{{docker_container_name}}.sh stop
ExecStopPost=/usr/bin/syncd.sh stop

{% if sonic_asic_platform == 'mellanox' %}
ExecStopPost=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management stop"
ExecStopPost=/etc/init.d/sxdkernel stop
ExecStopPost=/usr/bin/mst stop
{% elif sonic_asic_platform == 'cavium' %}
ExecStopPost=/etc/init.d/xpnet.sh stop
ExecStopPost=/etc/init.d/xpnet.sh start
{% endif %}

[Install]
WantedBy=multi-user.target
53 changes: 53 additions & 0 deletions files/build_templates/syncd.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[Unit]
Description=syncd service
Requires=database.service updategraph.service
{% if sonic_asic_platform == 'broadcom' %}
Requires=opennsl-modules-3.16.0-5-amd64.service
{% elif sonic_asic_platform == 'nephos' %}
Requires=nps-modules-3.16.0-5-amd64.service
{% endif %}
After=database.service updategraph.service
{% if sonic_asic_platform == 'broadcom' %}
After=opennsl-modules-3.16.0-5-amd64.service
{% elif sonic_asic_platform == 'nephos' %}
After=nps-modules-3.16.0-5-amd64.service
{% endif %}

[Service]
User=root
# Wait for redis server start before database clean
ExecStartPre=/bin/bash -c 'until [[ $(/usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]]; do sleep 1; done'
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 5 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 6 FLUSHDB

{% if sonic_asic_platform == 'mellanox' %}
Environment=FAST_BOOT=1
TimeoutStartSec=3min
ExecStartPre=/usr/bin/mst start
ExecStartPre=/usr/bin/mlnx-fw-upgrade.sh
ExecStartPre=/etc/init.d/sxdkernel start
ExecStartPre=/sbin/modprobe i2c-dev
ExecStartPre=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management start"
{% elif sonic_asic_platform == 'cavium' %}
ExecStartPre=/etc/init.d/xpnet.sh start
{% endif %}

ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh attach

ExecStop=/usr/bin/{{docker_container_name}}.sh stop

{% if sonic_asic_platform == 'mellanox' %}
ExecStopPost=/bin/bash -c "/usr/share/sonic/device/$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)/hw-management stop"
ExecStopPost=/etc/init.d/sxdkernel stop
ExecStopPost=/usr/bin/mst stop
{% elif sonic_asic_platform == 'cavium' %}
ExecStopPost=/etc/init.d/xpnet.sh stop
ExecStopPost=/etc/init.d/xpnet.sh start
{% endif %}

[Install]
WantedBy=multi-user.target