Skip to content

Commit

Permalink
[Services] Restart LLDP service upon unexpected critical process exit. (
Browse files Browse the repository at this point in the history
sonic-net#3713)

Signed-off-by: Yong Zhao <yozhao@microsoft.com>

    RB=2124908
    G=lnos-reviewers
    R=pchaudha,pmao,vapatil,zxu
    A=zxu
  • Loading branch information
yozhao101 authored and samaity committed May 29, 2020
1 parent c4de823 commit 071c9b3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dockers/docker-lldp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"]
COPY ["lldpd", "/etc/default/"]
COPY ["lldpmgrd", "/usr/bin/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]

ENTRYPOINT ["/usr/bin/supervisord"]
3 changes: 3 additions & 0 deletions dockers/docker-lldp-sv2/critical_processes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lldpd
lldp-syncd
lldpmgrd
6 changes: 6 additions & 0 deletions dockers/docker-lldp-sv2/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true

[eventlistener:supervisor-proc-exit-listener]
command=/usr/bin/supervisor-proc-exit-listener
events=PROCESS_STATE_EXITED
autostart=true
autorestart=unexpected

[program:start.sh]
command=/usr/bin/start.sh
priority=1
Expand Down
4 changes: 4 additions & 0 deletions files/build_templates/lldp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ Description=LLDP container
Requires=updategraph.service
After=updategraph.service
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3

[Service]
User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions rules/docker-lldp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ $(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl
$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += monit_lldp:/etc/monit/conf.d
$(DOCKER_LLDP_SV2)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

0 comments on commit 071c9b3

Please sign in to comment.