[Pmon] dynamically load pmon daemons (#2654)

* dynamically load pmon daemons
This commit is contained in:
Kebo Liu 2019-03-22 17:49:35 +08:00 committed by lguohan
parent 60968cf95b
commit 84b46bb0e0
12 changed files with 44 additions and 4 deletions

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1,4 @@
{
"skip_ledd": true
}

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -0,0 +1 @@
../x86_64-mlnx_msn2700-r0/pmon_daemon_control.json

View File

@ -55,7 +55,7 @@ RUN apt-get autoclean -y
RUN apt-get autoremove -y RUN apt-get autoremove -y
RUN rm -rf /debs /python-wheels ~/.cache RUN rm -rf /debs /python-wheels ~/.cache
COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"] COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"]
ENTRYPOINT ["/usr/bin/supervisord"] ENTRYPOINT ["/usr/bin/docker_init.sh"]

View File

@ -37,6 +37,7 @@ autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
{% if not skip_ledd %}
[program:ledd] [program:ledd]
command=/usr/bin/ledd command=/usr/bin/ledd
priority=5 priority=5
@ -45,7 +46,9 @@ autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
startsecs=0 startsecs=0
{% endif %}
{% if not skip_xcvrd %}
[program:xcvrd] [program:xcvrd]
command=/usr/bin/xcvrd command=/usr/bin/xcvrd
priority=6 priority=6
@ -54,7 +57,9 @@ autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
startsecs=0 startsecs=0
{% endif %}
{% if not skip_psud %}
[program:psud] [program:psud]
command=/usr/bin/psud command=/usr/bin/psud
priority=7 priority=7
@ -63,4 +68,4 @@ autorestart=false
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
startsecs=0 startsecs=0
{% endif %}

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Generate supervisord config file and the start.sh scripts
mkdir -p /etc/supervisor/conf.d/
if [ -e /usr/share/sonic/platform/pmon_daemon_control.json ];
then
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -t /usr/share/sonic/templates/start.sh.j2 > /usr/bin/start.sh
chmod +x /usr/bin/start.sh
else
sonic-cfggen -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -t /usr/share/sonic/templates/start.sh.j2 > /usr/bin/start.sh
chmod +x /usr/bin/start.sh
fi
exec /usr/bin/supervisord

View File

@ -37,8 +37,14 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then
supervisorctl start fancontrol supervisorctl start fancontrol
fi fi
{% if not skip_ledd %}
supervisorctl start ledd supervisorctl start ledd
{% endif %}
{% if not skip_xcvrd %}
supervisorctl start xcvrd supervisorctl start xcvrd
{% endif %}
{% if not skip_psud %}
supervisorctl start psud supervisorctl start psud
{% endif %}