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

[hostcfgd]: wait till system initialization is done before starting hostcfgd #6232

Merged
merged 4 commits into from
Dec 18, 2020

Conversation

arlakshm
Copy link
Contributor

@arlakshm arlakshm commented Dec 17, 2020

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan arlakshm@microsoft.com

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

- How I did it
use the commandsystemctl is-system-running --wait to wait till system has finished booting up
- How to verify it
Checkout journctl command output if the hostcfgd is waiting

admin@vlab-01:~$ sudo journalctl -u hostcfgd                                                                                                                                                                                 -- Logs begin at Thu 2020-12-17 01:06:59 UTC, end at Thu 2020-12-17 01:20:52 UTC. --                                                                                                                                         Dec 17 01:07:08 vlab-01 systemd[1]: Started Host config enforcer daemon.
Dec 17 01:07:08 vlab-01 /hostcfgd[849]: ConfigDB connect success
Dec 17 01:07:08 vlab-01 /hostcfgd[849]: KdumpCfg load ...
Dec 17 01:07:08 vlab-01 /hostcfgd[849]: Kdump global configuration update
Dec 17 01:07:10 vlab-01 sudo[1365]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/docker ps
Dec 17 01:07:10 vlab-01 sudo[1365]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:07:11 vlab-01 sudo[1365]: pam_unix(sudo:session): session closed for user root
Dec 17 01:07:11 vlab-01 python3[1303]: :- operator(): DB '{APPL_DB}' is empty with pattern '_GEARBOX_TABLE:phy:*'!
Dec 17 01:07:11 vlab-01 sudo[1465]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/docker ps
Dec 17 01:07:11 vlab-01 sudo[1465]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:07:11 vlab-01 sudo[1465]: pam_unix(sudo:session): session closed for user root
Dec 17 01:07:11 vlab-01 python3[1408]: :- operator(): DB '{APPL_DB}' is empty with pattern '_GEARBOX_TABLE:phy:*'!
Dec 17 01:07:11 vlab-01 hostcfgd[849]: kdump is already disabled
Dec 17 01:07:13 vlab-01 /hostcfgd[849]: Waiting for systemctl to finish initialization
Dec 17 01:07:13 vlab-01 sudo[1985]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/systemctl is-system-running --wait --quiet
Dec 17 01:07:13 vlab-01 sudo[1985]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:07:14 vlab-01 sudo[1985]: pam_unix(sudo:session): session closed for user root
Dec 17 01:07:14 vlab-01 /hostcfgd[849]: starting update of feature states
Dec 17 01:07:14 vlab-01 /hostcfgd[849]: Running cmd: 'sudo systemctl stop sflow.service'
Dec 17 01:07:14 vlab-01 sudo[2261]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/systemctl stop sflow.service
Dec 17 01:07:14 vlab-01 sudo[2261]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:07:14 vlab-01 sudo[2261]: pam_unix(sudo:session): session closed for user root
Dec 17 01:07:14 vlab-01 /hostcfgd[849]: Running cmd: 'sudo systemctl disable sflow.service'
Dec 17 01:07:14 vlab-01 sudo[2264]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/systemctl disable sflow.service
Dec 17 01:07:14 vlab-01 sudo[2264]: pam_unix(sudo:session): session opened for user root by (uid=0)
Dec 17 01:07:14 vlab-01 hostcfgd[849]: Unit /etc/systemd/system/sflow.service is masked, ignoring.
Dec 17 01:07:14 vlab-01 sudo[2264]: pam_unix(sudo:session): session closed for user root
Dec 17 01:07:14 vlab-01 /hostcfgd[849]: Running cmd: 'sudo systemctl mask sflow.service'
Dec 17 01:07:14 vlab-01 sudo[2288]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/systemctl mask sflow.service
Dec 17 01:07:14 vlab-01 sudo[2288]: 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 <arlakshm@microsoft.com>
@arlakshm arlakshm marked this pull request as ready for review December 17, 2020 01:25
@arlakshm arlakshm requested a review from abdosi December 17, 2020 01:29
@abdosi abdosi requested a review from jleveque December 17, 2020 01:31
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@arlakshm arlakshm requested a review from jleveque December 17, 2020 01:47
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
@arlakshm
Copy link
Contributor Author

retest vsimage please

@arlakshm arlakshm merged commit 317a4b3 into sonic-net:master Dec 18, 2020
@arlakshm arlakshm deleted the hostcfgd_change branch December 18, 2020 01:03
arlakshm added a commit that referenced this pull request Dec 18, 2020
…s done (#6234)

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

- How I did it
This is port of the PR #6232.
Since the systemctl version in 201911 doesn't 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.

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
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.

5 participants