Make determine-reboot-cause into oneshot service #12628
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why I did it
"show reboot-cause history" does not report the latest reboot-cause because process-reboot-cause does not wait for determine-reboot-cause to complete running before it starts.
Currently the system just assumes that process-reboot-cause will run after determine-reboot-cause based on timing. This fix is fixing the race condition that might happen if the determine-reboot-cause does not finish before process-reboot-cause.
How I did it
This PR makes determine-reboot-cause.service into a oneshot service to ensure process-reboot-cause only runs once determine-reboot-cause completes.
This fix depends on a PR for process-reboot-cause.service dependency, which needs to be committed to 202205 branch.
#11213
How to verify it
Run "show reboot-cause" and "show reboot-cause history"
The latest entry in reboot-cause history should match the output of show reboot-cause.
Can check the journal logs of determine-reboot-cause.service and process-reboot-cause.service after a reboot to confirm that process-reboot-cause only runs after determine-reboot cause.
Which release branch to backport (provide reason below if selected)
Description for the changelog
Update determine-reboot-cause.service to be oneshot service to ensure it completes before process-reboot-cause.service runs
Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
Link to config_db schema for YANG module changes