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

[201911][hostcfgd]:wait updating the feature table till system init is done #6234

Merged
merged 2 commits into from
Dec 18, 2020

Conversation

arlakshm
Copy link
Contributor

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- Why I did it
The change is done to make sure the system initialization is done before starting the hostcfgd sets the feature states.

- How I did it
This is port of the PR #6232.
Since the systemctl version in 201911 doesnt support --wait.
Added a function to check the output of systemctl is-system-running every second, till the command system is done booting up.

For now this change is only applicable to multi asic platforms based on the testing this change will be extended to all platforms in the future PR.

- How to verify it
Checkout journctl command output to see

admin@sonic:~$ sudo journalctl -u hostcfgd
-- Logs begin at Thu 2020-12-17 01:40:15 UTC, end at Thu 2020-12-17 06:15:50 UTC. --
Dec 17 01:40:36 sonic systemd[1]: Started Host config enforcer daemon.
Dec 17 01:40:36 sonic hostcfgd[4362]: ConfigDB connect success
Dec 17 01:40:36 sonic hostcfgd[4362]: Waiting for systemctl to finish initialization
Dec 17 01:40:36 sonic sudo[4438]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:36 sonic sudo[4438]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:37 sonic sudo[4950]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:37 sonic sudo[4950]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:39 sonic sudo[5465]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:39 sonic sudo[5465]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:40 sonic sudo[6179]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:40 sonic sudo[6179]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:41 sonic sudo[6473]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:41 sonic sudo[6473]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:42 sonic sudo[6859]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:42 sonic sudo[6859]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:43 sonic sudo[7082]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:43 sonic sudo[7082]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:44 sonic sudo[7642]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:44 sonic sudo[7642]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:44 sonic sudo[7642]: pam_unix(sudo:session): session closed for user root
Dec 17 01:40:45 sonic sudo[8134]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:45 sonic sudo[8134]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:45 sonic sudo[8134]: pam_unix(sudo:session): session closed for user root
Dec 17 01:40:46 sonic sudo[8383]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:46 sonic sudo[8383]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:47 sonic sudo[8567]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:47 sonic sudo[8567]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:48 sonic sudo[8843]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:48 sonic sudo[8843]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:49 sonic sudo[9176]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:49 sonic sudo[9176]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:50 sonic sudo[9502]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:50 sonic sudo[9502]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:51 sonic sudo[10074]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:51 sonic sudo[10074]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:52 sonic sudo[10415]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:52 sonic sudo[10415]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:53 sonic sudo[10663]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:53 sonic sudo[10663]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:55 sonic sudo[11077]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:55 sonic sudo[11077]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:56 sonic sudo[11506]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:56 sonic sudo[11506]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:57 sonic sudo[12206]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:57 sonic sudo[12206]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:58 sonic sudo[12412]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:58 sonic sudo[12412]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic sudo[12580]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl is-system-running
Dec 17 01:40:59 sonic sudo[12580]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: starting updating the feature states
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl unmask lldp.service'
Dec 17 01:40:59 sonic sudo[12584]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl unmask lldp.service
Dec 17 01:40:59 sonic sudo[12584]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl enable lldp.service'
Dec 17 01:40:59 sonic sudo[12625]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl enable lldp.service
Dec 17 01:40:59 sonic sudo[12625]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl start lldp.service'
Dec 17 01:40:59 sonic sudo[12653]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl start lldp.service
Dec 17 01:40:59 sonic sudo[12653]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl unmask lldp.service'
Dec 17 01:40:59 sonic sudo[12659]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl unmask lldp.service
Dec 17 01:40:59 sonic sudo[12659]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl enable lldp.service'
Dec 17 01:40:59 sonic sudo[12686]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl enable lldp.service
Dec 17 01:40:59 sonic sudo[12686]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic sudo[12686]: pam_unix(sudo:session): session closed for user root
Dec 17 01:40:59 sonic sudo[12686]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl enable lldp.service
Dec 17 01:40:59 sonic sudo[12686]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic sudo[12686]: pam_unix(sudo:session): session closed for user root
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl start lldp.service'
Dec 17 01:40:59 sonic sudo[12711]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl start lldp.service
Dec 17 01:40:59 sonic sudo[12711]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl unmask [email protected]'
Dec 17 01:40:59 sonic sudo[12715]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl unmask [email protected]
Dec 17 01:40:59 sonic sudo[12715]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:40:59 sonic hostcfgd[4362]: Running cmd: 'sudo systemctl enable [email protected]'
Dec 17 01:40:59 sonic sudo[12747]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl enable [email protected]
Dec 17 01:40:59 sonic sudo[12747]: pam_unix(sudo:session): session opened for user root by (uid=0)

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm arlakshm marked this pull request as ready for review December 17, 2020 20:34
@arlakshm arlakshm requested review from jleveque and abdosi December 17, 2020 20:34
@arlakshm arlakshm changed the title [hostcfgd]:wait updating the feature table till system init is done [201911][hostcfgd]:wait updating the feature table till system init is done Dec 17, 2020
files/image_config/hostcfgd/hostcfgd Outdated Show resolved Hide resolved
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
@arlakshm arlakshm requested a review from jleveque December 18, 2020 00:42
@arlakshm arlakshm merged commit 7f76698 into sonic-net:201911 Dec 18, 2020
@arlakshm arlakshm deleted the hostcfgd_change_201911 branch December 18, 2020 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants