[agent][ssd] Fix NameError: nand_endurance undefined in parse_micron_info()#646
[agent][ssd] Fix NameError: nand_endurance undefined in parse_micron_info()#646rustiqly wants to merge 5 commits into
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
The nand_endurance fix is correct — it was indeed undefined and would crash. However, I am not sure about removing the erase_fail_count check from the guard condition. The original code checked both average_erase_count and erase_fail_count before computing health. While erase_fail_count is not used in the formula, it may have been an intentional sanity gate — i.e., do not report health percentage if we cannot read erase failure data from the drive. Suggestion: keep erase_fail_count in the guard and add nand_endurance: if average_erase_count != NOT_AVAILABLE and erase_fail_count != NOT_AVAILABLE and nand_endurance != NOT_AVAILABLE:This way we fix the NameError without changing the original gating logic. Also, erase_fail_count should be kept as a parsed variable even if unused in the formula — removing it changes the behavior silently. This comment was posted by an AI agent on behalf of @yxieca. |
|
@rustiqly please consider adding unit test. |
|
@yxieca acknowledged, I will work on adding the unit test coverage. |
865174d to
69fa5f7
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Added Micron SSD unit coverage in |
|
Pushed follow-up Root cause from CI: The new fallback path was passing the full parsed SMART attribute tail into Validation on this host: The targeted pytest collection is still blocked locally by missing |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Pushed follow-up Root cause: Change: parse the final numeric field from the SMART row for Validation:
Local pytest is blocked on this host because /azp run |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Pushed follow-up Root cause: the previous NAND_Endurance regex change accidentally altered the existing Virtium parser to read the last column ( Fix: restored the Virtium-specific raw-value parsing and kept the Micron NAND_Endurance fallback as a separate SMART-table parse. Validation: confirmed the regex extraction for both Virtium ( |
|
/azp run |
|
Azure Pipelines failed to run 1 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
2ff5458 to
27365fa
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…info() parse_micron_info() references nand_endurance which was never defined in this method (only exists in parse_virtium_info). Parse it from SMART attributes using the same regex pattern as the Virtium parser. Also remove the unused erase_fail_count variable. Fixes: sonic-net#644 Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
27365fa to
70efdf5
Compare
What I did
Fix
NameErrorinparse_micron_info()wherenand_enduranceis referenced but never defined.How I did it
nand_endurancefrom SMART attributes using_parse_re()with the sameNAND_Enduranceregex pattern used inparse_virtium_info()nand_endurance != NOT_AVAILABLEcheckerase_fail_countvariable (was fetched but never used in the calculation)How to verify it
Run on a Micron SSD where
Percent_Lifetime_UsedandPercent_Lifetime_Remainare both unavailable — should no longer crash withNameError.Which release branch to backport
master
Description for the changelog
Fix NameError crash in Micron SSD health parsing due to undefined nand_endurance variable.
Fixes: #644