Skip to content

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

Merged
sujinmkang merged 1 commit intosonic-net:202012from
keboliu:202012-ssd-fix
Apr 7, 2022
Merged

[202012] Backport Enhance ssd_generic with more error handling to avoid python crash#273
sujinmkang merged 1 commit intosonic-net:202012from
keboliu:202012-ssd-fix

Conversation

@keboliu
Copy link
Copy Markdown
Collaborator

@keboliu keboliu commented Apr 5, 2022

Signed-off-by: Kebo Liu kebol@nvidia.com

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
Copy Markdown
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
Copy Markdown

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