[action] [PR:28415] [system-health]: Honor 'psu' and 'pdb' device ignore independently in hardware checker#28616
Open
mssonicbld wants to merge 1 commit into
Open
Conversation
… hardware checker #### Why I did it `show system-health detail` reports **Hardware: Not OK** with reason **"Failed to get PSU information"** on platforms that have no PSUs and whose `system_health_monitoring_config.json` lists `psu` in `devices_to_ignore` **but not** `pdb` — even though `psu` is shown as ignored. This is a regression from sonic-net#26829 ("Add PDB support for system-health"), which changed the `_check_psu_status` early-return guard to require **both** `psu` and `pdb` to be ignored. When only `psu` is ignored, the checker proceeds, finds an empty `PSU_INFO`, and reports the failure. The same change also silently re-enabled per-PSU checks on switches that ignore the `psu` category but not `pdb`. fixes sonic-net#28414 ##### Work item tracking - Microsoft ADO **(number only)**: 38803669 #### How I did it In `src/system-health/health_checker/hardware_checker.py`, `_check_psu_status` now honors `psu` and `pdb` independently: - Skip the whole check only when **both** `psu` and `pdb` are ignored. - Report the empty-`PSU_INFO` "Failed to get PSU information" failure only when `psu` is **not** ignored (so a genuinely broken `psud` on a real switch is still detected). - Per row, skip PSU rows when `psu` is ignored and PDB rows (keyed `PDB N`) when `pdb` is ignored. Added regression unit tests in `src/system-health/tests/test_system_health.py`. #### How to verify it 1. Unit tests: ``` cd src/system-health && python3 -m pytest tests/test_system_health.py -k "hardware or psu or pdb or config" ``` 2. Manual: on a platform with no `PSU_INFO` in STATE_DB, set `devices_to_ignore` to include `psu` (and `fan`) but **not** `pdb`, restart the `system-health` service, and confirm `show system-health detail` reports **Hardware: OK** (previously **Not OK — Failed to get PSU information**). 3. Confirm a platform that exposes PSUs still reports PSU failures when `psu` is not ignored, and that PDB rows are still evaluated when only `psu` is ignored. #### Which release branch to backport (provide reason below if selected) - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 - [ ] 202511 - [ ] 202512 - [x] 202605 - [ ] 202608 Reason: the regression (sonic-net#26829) is present on `master` and `202605`; the fix should follow it wherever `sonic-net#26829` is merged. #### Tested branch (Please provide the tested image version) - [x] Validated via the unit tests above on `master`; the regression was originally observed on `20260510`. #### Description for the changelog [system-health] Fix false "Failed to get PSU information" when only 'psu' (not 'pdb') is in devices_to_ignore #### Link to config_db schema for YANG module changes N/A — no YANG/config_db schema changes. #### A picture of a cute animal (not mandatory but encouraged) 🐾🐱 Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: #28415 |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Merged
10 tasks
Collaborator
Author
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 system-health detailreports Hardware: Not OK with reason "Failed to get PSU information" on platforms that have no PSUs and whosesystem_health_monitoring_config.jsonlistspsuindevices_to_ignorebut notpdb— even thoughpsuis shown as ignored.This is a regression from #26829 ("Add PDB support for system-health"), which changed the
_check_psu_statusearly-return guard to require bothpsuandpdbto be ignored. When onlypsuis ignored, the checker proceeds, finds an emptyPSU_INFO, and reports the failure. The same change also silently re-enabled per-PSU checks on switches that ignore thepsucategory but notpdb.fixes #28414
Work item tracking
How I did it
In
src/system-health/health_checker/hardware_checker.py,_check_psu_statusnow honorspsuandpdbindependently:psuandpdbare ignored.PSU_INFO"Failed to get PSU information" failure only whenpsuis not ignored (so a genuinely brokenpsudon a real switch is still detected).psuis ignored and PDB rows (keyedPDB N) whenpdbis ignored.Added regression unit tests in
src/system-health/tests/test_system_health.py.How to verify it
PSU_INFOin STATE_DB, setdevices_to_ignoreto includepsu(andfan) but notpdb, restart thesystem-healthservice, and confirmshow system-health detailreports Hardware: OK (previously Not OK — Failed to get PSU information).psuis not ignored, and that PDB rows are still evaluated when onlypsuis ignored.Which release branch to backport (provide reason below if selected)
Reason: the regression (#26829) is present on
masterand202605; the fix should follow it wherever#26829is merged.Tested branch (Please provide the tested image version)
master; the regression was originally observed on20260510.Description for the changelog
[system-health] Fix false "Failed to get PSU information" when only 'psu' (not 'pdb') is in devices_to_ignore
Link to config_db schema for YANG module changes
N/A — no YANG/config_db schema changes.
A picture of a cute animal (not mandatory but encouraged)
🐾🐱
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com