Move eventd enabled check from build time to runtime#20248
Move eventd enabled check from build time to runtime#20248qiluo-msft merged 13 commits intosonic-net:masterfrom
Conversation
|
hi @yxieca could you cherry pick? |
|
hi @zbud-msft do we need this one for 202405? |
|
@zbud-msft, @qiluo-msft We are only cherry-pick bug fix for 202405 branch. This seems to be an enhancement to me. Please clarify if this is a must-have for 202405 branch. Thanks! |
## How I did it Remove eventd enabled/slim image check from Dockerfile (build time). As part of Dockerfile expose eventd_enabled and slim image flags to ENV which will be used docker_init/start.sh to check if rsyslog plugin should be moved to rsyslog.d #### How to verify it Manual test/pipeline
|
Cherry-pick PR to 202405: #20351 |
## How I did it Remove eventd enabled/slim image check from Dockerfile (build time). As part of Dockerfile expose eventd_enabled and slim image flags to ENV which will be used docker_init/start.sh to check if rsyslog plugin should be moved to rsyslog.d #### How to verify it Manual test/pipeline
stepanblyschak
left a comment
There was a problem hiding this comment.
We notice few issues in 202405 regression, @zbud-msft @qiluo-msft Could you please have a look?
| {%- elif docker_container_name == "eventd" %} | ||
| export EVENTD_STATE=$(sonic-db-cli -s CONFIG_DB HGET 'FEATURE|eventd' 'state') | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/events_info.json > /etc/rsyslog.d/host_events.conf | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/syncd_events_info.json > /etc/rsyslog.d/syncd_events.conf |
There was a problem hiding this comment.
@zbud-msft @qiluo-msft These commands are CPU heavy as well as those added in docker-init.j2 for multiple containers.
Any performance measurements done w.r.t fast-reboot, warm-reboot to understand the impact?
Any idea how to achieve same functionality without introducing additional CPU overhead during init?
| # properly configured, we exec /usr/local/bin/supervisord so that it runs as PID 1 for the | ||
| # duration of the container's lifetime | ||
| export EVENTD_STATE=$(sonic-db-cli -s CONFIG_DB HGET 'FEATURE|eventd' 'state') | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/events_info.json > /etc/rsyslog.d/dhcp_relay_events.conf |
There was a problem hiding this comment.
@zbud-msft What if eventd state changes in runtime ? Is this flow unsupported ?
| export EVENTD_STATE=$(sonic-db-cli -s CONFIG_DB HGET 'FEATURE|eventd' 'state') | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/events_info.json > /etc/rsyslog.d/host_events.conf | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/syncd_events_info.json > /etc/rsyslog.d/syncd_events.conf | ||
| systemctl restart rsyslog |
There was a problem hiding this comment.
@zbud-msft @qiluo-msft In our testing this introduces a race between eventd's postStartAction and rsyslog-config service. rsyslog-config.service will overwrite /etc/rsyslog.conf and when at the same time we restart rsyslogd we'll get rsyslogd exited and then eventd service start failure.
| export EVENTD_STATE=$(sonic-db-cli -s CONFIG_DB HGET 'FEATURE|eventd' 'state') | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/events_info.json > /etc/rsyslog.d/host_events.conf | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/syncd_events_info.json > /etc/rsyslog.d/syncd_events.conf | ||
| systemctl restart rsyslog |
There was a problem hiding this comment.
In case this fails eventd docker will be still running
| export EVENTD_STATE=$(sonic-db-cli -s CONFIG_DB HGET 'FEATURE|eventd' 'state') | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/events_info.json > /etc/rsyslog.d/host_events.conf | ||
| j2 -f json --import-env=ENVIRONMENT /usr/share/sonic/templates/rsyslog_plugin/rsyslog_plugin.conf.j2 /usr/share/sonic/templates/rsyslog_plugin/syncd_events_info.json > /etc/rsyslog.d/syncd_events.conf | ||
| systemctl restart rsyslog |
There was a problem hiding this comment.
@zbud-msft @qiluo-msft We will loose syslog messages during boot up
|
@zbud-msft @qiluo-msft Could you please have a look - #20544 ? |
…et#20248)" (sonic-net#20947) Reverts sonic-net#20248 and fixes sonic-net#20544 This reverts commit 561479e.
Why I did it
Work item tracking
How I did it
Remove eventd enabled/slim image check from Dockerfile (build time). As part of Dockerfile expose eventd_enabled and slim image flags to ENV which will be used docker_init/start.sh to check if rsyslog plugin should be moved to rsyslog.d
How to verify it
Manual test/pipeline
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)