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

[Pmon] Selectively load pmon container daemons #2625

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"skip_ledd": 1,
"skip_xcvrd": 0,
"skip_psud": 0
}

6 changes: 3 additions & 3 deletions dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RUN apt-get autoclean -y
RUN apt-get autoremove -y
RUN rm -rf /debs /python-wheels ~/.cache

COPY ["start.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"]

ENTRYPOINT ["/usr/bin/supervisord"]
ENTRYPOINT ["/usr/bin/docker_init.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

{% if skip_ledd != 1 %}
Copy link
Contributor

@jleveque jleveque Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debating whether these values should be True instead of 1 to be more Pythonic. The condition could also be changed to if skip_ledd which should evaluate to False if the variable is not defined, or if it is defined and set to 'False'. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jleveque I change the values from int to boolean.
the current implementation(already supported in the previous commit) is like this:

  1. set xxx_skip = true in the json, the conf will NOT be generated,
  2. if xxx_skip not set in the json, the conf will be generated,
  3. if xxx_skip set to false in the json, the conf will also be generated.

I also removed the "xxx_skip = fase" setting from the Mellanox platform configuration to avoid missleading.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jleveque due to some tricky conflicts that I am not able to resolve, I choose to close this PR and opened a new one: #2654 please switch to the new one, sorry for the inconvenience.

[program:ledd]
command=/usr/bin/ledd
priority=5
Expand All @@ -45,7 +46,9 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0
{% endif %}

{% if skip_xcvrd != 1 %}
[program:xcvrd]
command=/usr/bin/xcvrd
priority=6
Expand All @@ -54,7 +57,9 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0
{% endif %}

{% if skip_psud != 1 %}
[program:psud]
command=/usr/bin/psud
priority=7
Expand All @@ -63,4 +68,4 @@ autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
startsecs=0

{% endif %}
16 changes: 16 additions & 0 deletions dockers/docker-platform-monitor/docker_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/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
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then
supervisorctl start fancontrol
fi

{% if skip_ledd != 1 %}
supervisorctl start ledd
{% endif %}

{% if skip_xcvrd != 1 %}
supervisorctl start xcvrd
{% endif %}

{% if skip_psud != 1 %}
supervisorctl start psud
{% endif %}