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

[determine-reboot-cause] Support 'Kernel Panic' reboot cause #7153

Merged
merged 5 commits into from
Mar 31, 2021

Conversation

yozhao101
Copy link
Contributor

@yozhao101 yozhao101 commented Mar 25, 2021

Signed-off-by: Yong Zhao [email protected]

Why I did it

If device reboot was caused by kernel panic, then we need retrieve and store the key information into the symbol file previous-reboot-cause.json. The CLI show reboot-cause will read this file to get the reason of previous reboot.

This PR is related to PR in sonic-utilities repo: sonic-net/sonic-utilities#1486

How I did it

The string variable previous_reboot_cause will be parsed to check whether it contains the keyword Kernel Panic. If it did, then store the keyword and time information into a dictionary.

How to verify it

I verified this change on a virtual testbed.

admin@vlab-01:/host/reboot-cause$ more previous-reboot-cause.json
{"gen_time": "2021_03_24_23_22_35", "cause": "Kernel Panic", "user": "N/A", "time": "Wed 24 Mar 2021 11:22:03 PM UTC", "comment": "N/A"}

admin@vlab-01:/host/reboot-cause$ show reboot-cause
Kernel Panic [Time: Wed 24 Mar 2021 11:22:03 PM UTC]

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

  • 201811
  • 201911
  • 202006
  • [x ] 202012

Description for the changelog

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

@yozhao101 yozhao101 requested a review from lguohan as a code owner March 25, 2021 19:44
@yozhao101 yozhao101 requested a review from jleveque March 25, 2021 20:21
@jleveque jleveque changed the title [reboot] Retrieve and store the reboot reason if kernel was panicked. [determine-reboot-cause] Support 'Kernel Panic' reboot cause Mar 25, 2021
@lguohan
Copy link
Collaborator

lguohan commented Mar 27, 2021

can you add unit test?

@yozhao101
Copy link
Contributor Author

can you add unit test?

Yes, I will add unit test.

@yozhao101 yozhao101 merged commit 6fc5897 into sonic-net:master Mar 31, 2021
@yozhao101 yozhao101 deleted the reboot_kernel_panic branch March 31, 2021 19:14
daall pushed a commit that referenced this pull request Mar 31, 2021
Signed-off-by: Yong Zhao [email protected]

Why I did it
If device reboot was caused by kernel panic, then we need retrieve and store the key information into the symbol file previous-reboot-cause.json. The CLI show reboot-cause will read this file to get the reason of previous reboot.

This PR is related to PR in sonic-utilities repo: sonic-net/sonic-utilities#1486

How I did it
The string variable previous_reboot_cause will be parsed to check whether it contains the keyword Kernel Panic. If it did, then store the keyword and time information into a dictionary.

How to verify it
I verified this change on a virtual testbed.

admin@vlab-01:/host/reboot-cause$ more previous-reboot-cause.json
{"gen_time": "2021_03_24_23_22_35", "cause": "Kernel Panic", "user": "N/A", "time": "Wed 24 Mar 2021 11:22:03 PM UTC", "comment": "N/A"}

admin@vlab-01:/host/reboot-cause$ show reboot-cause
Kernel Panic [Time: Wed 24 Mar 2021 11:22:03 PM UTC]
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
…et#7153)

Signed-off-by: Yong Zhao [email protected]

Why I did it
If device reboot was caused by kernel panic, then we need retrieve and store the key information into the symbol file previous-reboot-cause.json. The CLI show reboot-cause will read this file to get the reason of previous reboot.

This PR is related to PR in sonic-utilities repo: sonic-net/sonic-utilities#1486

How I did it
The string variable previous_reboot_cause will be parsed to check whether it contains the keyword Kernel Panic. If it did, then store the keyword and time information into a dictionary.

How to verify it
I verified this change on a virtual testbed.

admin@vlab-01:/host/reboot-cause$ more previous-reboot-cause.json
{"gen_time": "2021_03_24_23_22_35", "cause": "Kernel Panic", "user": "N/A", "time": "Wed 24 Mar 2021 11:22:03 PM UTC", "comment": "N/A"}

admin@vlab-01:/host/reboot-cause$ show reboot-cause
Kernel Panic [Time: Wed 24 Mar 2021 11:22:03 PM UTC]
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…et#7153)

Signed-off-by: Yong Zhao [email protected]

Why I did it
If device reboot was caused by kernel panic, then we need retrieve and store the key information into the symbol file previous-reboot-cause.json. The CLI show reboot-cause will read this file to get the reason of previous reboot.

This PR is related to PR in sonic-utilities repo: sonic-net/sonic-utilities#1486

How I did it
The string variable previous_reboot_cause will be parsed to check whether it contains the keyword Kernel Panic. If it did, then store the keyword and time information into a dictionary.

How to verify it
I verified this change on a virtual testbed.

admin@vlab-01:/host/reboot-cause$ more previous-reboot-cause.json
{"gen_time": "2021_03_24_23_22_35", "cause": "Kernel Panic", "user": "N/A", "time": "Wed 24 Mar 2021 11:22:03 PM UTC", "comment": "N/A"}

admin@vlab-01:/host/reboot-cause$ show reboot-cause
Kernel Panic [Time: Wed 24 Mar 2021 11:22:03 PM UTC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants