Use upholds to ensure determine service startes after process service.#100
Use upholds to ensure determine service startes after process service.#100xincunli-sonic wants to merge 1 commit intomasterfrom
Conversation
| Description=Retrieve the reboot cause from the history files and save them to StateDB | ||
| Requires=database.service determine-reboot-cause.service | ||
| After=database.service determine-reboot-cause.service | ||
| Upholds=database.service determine-reboot-cause.service |
There was a problem hiding this comment.
If I'm understanding Upholds= correctly, this would mean that if database.service fails to start up for whatever reason, then this service can still start, since there's no longer a hard dependency on the database container. However, it looks like process-reboot-cause writes to state DB, which would then fail, and then cause this service to fail.
There was a problem hiding this comment.
Yes, that is expected, If the database service did not start correctly, the process-reboot-cause will not start correctly which will failing in read db as expected, so it will not persist any cause into db until next reboot and database service started correctly.
|
@xincunli-sonic PR description is incorrect. The issue need to be fixed is #88. Description should be "Restart process-reboot-cause and determine-reboot-cause services automatically whenever database service restarts" Consider a case where lets say database service fails to start for whatever reason, now determine-reboot cause and process-reboot-cause does not start because database service is not started i.e process-reboot-cause and determine-reboot case remains in dependency failed state. After sometime, database service is restarted, then process-reboot-cause and determine-reboot-cause must start automatically. |
prgeor
left a comment
There was a problem hiding this comment.
@xincunli-sonic can you make requested changes
Signed-off-by: Xincun Li xincun.li@microsoft.com
Why I did it
To enhance system stability and optimize inter-service dependencies, I removed the determine-reboot-cause's dependency on database.service and improved process-reboot-cause's dependency on database.service. This was achieved using the upholds feature in Debian 12#249, ensuring a more reliable and efficient operational environment.
MSFT ADO: 26209780
How I did it
How to verify it
Steps:
admin@str3-msn4600c-acs-05:/etc/systemd/system$ sudo systemctl list-dependencies process-reboot-cause
process-reboot-cause.service
● ├─database.service
● ├─determine-reboot-cause.service
● ├─system.slice
● └─sysinit.target
● ├─apparmor.service
● ├─dev-hugepages.mount
● ├─dev-mqueue.mount
● ├─haveged.service
● ├─kmod-static-nodes.service
● ├─proc-sys-fs-binfmt_misc.automount
● ├─sys-fs-fuse-connections.mount
● ├─sys-kernel-config.mount
● ├─sys-kernel-debug.mount
● ├─sys-kernel-tracing.mount
● ├─systemd-ask-password-console.path
● ├─systemd-binfmt.service
○ ├─systemd-firstboot.service
● ├─systemd-journal-flush.service
● ├─systemd-journald.service
○ ├─systemd-machine-id-commit.service
● ├─systemd-modules-load.service
○ ├─systemd-pcrphase-sysinit.service
○ ├─systemd-pcrphase.service
○ ├─systemd-pstore.service
● ├─systemd-random-seed.service
○ ├─systemd-repart.service
● ├─systemd-sysctl.service
● ├─systemd-sysusers.service
● ├─systemd-tmpfiles-setup-dev.service
● ├─systemd-tmpfiles-setup.service
● ├─systemd-udev-trigger.service
● ├─systemd-udevd.service
● ├─systemd-update-utmp.service
● ├─cryptsetup.target
● ├─integritysetup.target
● ├─local-fs.target
● │ └─systemd-remount-fs.service
● ├─swap.target
● └─veritysetup.target