Skip to content

[202012] Backport Enhance ssd_generic with more error handling to avoid python crash #273

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

Merged
merged 1 commit into from
Apr 7, 2022

Conversation

keboliu
Copy link
Collaborator

@keboliu keboliu commented Apr 5, 2022

Signed-off-by: Kebo Liu [email protected]

Description

Backport #271 to 202012

  1. Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash.

  2. Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end.

Motivation and Context

  1. Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash.

  2. On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case.

How Has This Been Tested?

  1. UT test has been added.
  2. Tested the change on platforms with different types of SSD.

Additional Information (Optional)

@liat-grozovik
Copy link
Collaborator

@sujinmkang could you please also signoff this backport PR?

@sujinmkang sujinmkang merged commit cd623fa into sonic-net:202012 Apr 7, 2022
@qiluo-msft
Copy link

It's already on 202012. No need to request cherry-pick.

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