Skip to content

[action] [PR:28415] [system-health]: Honor 'psu' and 'pdb' device ignore independently in hardware checker#28616

Open
mssonicbld wants to merge 1 commit into
sonic-net:202605from
mssonicbld:cherry/202605/28415
Open

[action] [PR:28415] [system-health]: Honor 'psu' and 'pdb' device ignore independently in hardware checker#28616
mssonicbld wants to merge 1 commit into
sonic-net:202605from
mssonicbld:cherry/202605/28415

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator

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 #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 #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
  • 202605
  • 202608

Reason: the regression (#26829) is present on master and 202605; the fix should follow it wherever #26829 is merged.

Tested branch (Please provide the tested image version)

  • 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

… 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>
@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Original PR: #28415

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run Azure.sonic-buildimage

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@vvolam

vvolam commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

/azp run Azure.sonic-buildimage

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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.

2 participants