Skip to content

[process-reboot-cause] Save boot_id and device fields for DPU reboot cause - #405

Open
chartsai-nvidia wants to merge 5 commits into
sonic-net:masterfrom
chartsai-nvidia:chartsai/pmon-hld-update
Open

[process-reboot-cause] Save boot_id and device fields for DPU reboot cause#405
chartsai-nvidia wants to merge 5 commits into
sonic-net:masterfrom
chartsai-nvidia:chartsai/pmon-hld-update

Conversation

@chartsai-nvidia

@chartsai-nvidia chartsai-nvidia commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Why I did it

DPU reboot-cause entries written to CHASSIS_STATE_DB were missing the boot_id and
device fields, so consumers couldn't correlate a DPU reboot with its boot instance or
source device. NPU entries are unaffected.

Work item tracking
  • Microsoft ADO (number only): N/A

How I did it

  • Defined NPU_REBOOT_CAUSE_DB_FIELDS (cause, time, user, comment) and
    DPU_REBOOT_CAUSE_DB_FIELDS (adds boot_id, device) in process-reboot-cause.
  • Replaced the hardcoded per-field db.set calls with a loop over the field set
    selected by device type, so DPU rows now include boot_id and device.
  • Converted the showtech dump-path regex to a raw string to avoid invalid escape
    sequence warnings without changing its matching behavior.

How to verify it

  • Run the unit tests: tests/process-reboot-cause_test.py now asserts that a DPU
    reboot-cause file results in boot_id and device being written to
    CHASSIS_STATE_DB.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411

Description for the changelog

Save boot_id and device fields for DPU reboot-cause entries

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

12 similar comments
@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

This PR has backport request label(s) for branch(es): 202605, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202605: <test result>) in the Test result section as well in your PR description.

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

1 similar comment
@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@mssonicbld

Copy link
Copy Markdown

Hi @sonic-net/sonic-host-services-maintainer, this approved PR has workflow run(s) waiting for approval. Please help review. Thanks!

---Powered by SONiC BuildBot

@vvolam vvolam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup — the loop-over-field-set refactor is clear and backward-compatible (NPU rows keep exactly cause/time/user/comment). One correctness gap inline regarding the device field, plus an optional nit below.

Nit (optional): to keep the two tuples from drifting, consider deriving one from the other:

NPU_REBOOT_CAUSE_DB_FIELDS = ("cause", "time", "user", "comment")
DPU_REBOOT_CAUSE_DB_FIELDS = NPU_REBOOT_CAUSE_DB_FIELDS + ("boot_id", "device")

Comment thread scripts/process-reboot-cause Outdated
Signed-off-by: Charles Tsai <chartsai@nvidia.com>
Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@chartsai-nvidia
chartsai-nvidia force-pushed the chartsai/pmon-hld-update branch from 187331d to 160ba86 Compare July 24, 2026 18:28
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

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

Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

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

@dgsudharsan
dgsudharsan requested a review from vvolam August 28, 2026 16:01
@vvolam

vvolam commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The updated test_read_reboot_cause_files_and_save_to_db nicely confirms DPU rows now include boot_id/device, but nothing locks in the "NPU entries are unaffected" contract from the PR description. Since the field selection now hinges on device == 'npu', a future edit to NPU_REBOOT_CAUSE_DB_FIELDS could silently start writing DPU-only fields into STATE_DB without any test failing.

Consider adding a negative assertion in an NPU-focused test (where read_reboot_cause_files_and_save_to_db('npu') is invoked) so the boundary is enforced:

# NPU path must NOT write DPU-only fields
written_fields = {call.args[2] for call in mock_db.set.call_args_list}
assert "boot_id" not in written_fields
assert "device" not in written_fields

Purely additive — nothing here blocks merge.

Signed-off-by: Charles Tsai <chartsai@nvidia.com>

@vvolam vvolam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@vvolam

vvolam commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

/azpw run

@mssonicbld

Copy link
Copy Markdown

⚠️ Notice: /azpw run only runs failed jobs now. If you want to trigger a whole pipline run, please rebase your branch or close and reopen the PR.
💡 Tip: You can also use /azpw retry to retry failed jobs directly.

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown

No Azure DevOps builds found for #405.

@vvolam

vvolam commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

/azpw retry

@mssonicbld

Copy link
Copy Markdown

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown

No Azure DevOps builds found for #405.

@mssonicbld

Copy link
Copy Markdown

/azp run

@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants