Skip to content

tentacle: pybind/mgr/status: drop asserts that fight the defaultdict defaults - #68954

Merged
batrick merged 2 commits into
ceph:tentaclefrom
tchaikov:wip-76634-tentacle
Aug 21, 2026
Merged

batrick merged 2 commits into
ceph:tentaclefrom
tchaikov:wip-76634-tentacle

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

tchaikov added 2 commits May 17, 2026 10:30
Enable type narrowing for get_metadata() when a non-None default is
provided. Previously, the return type was always `Optional[Dict[str, str]]`,
forcing callers to use defensive `assert metadata` checks even when
a result was guaranteed.

The wrapper returns either the metadata from `_ceph_get_metadata()` or the
caller-supplied default. Providing an `@overload` allows type checkers to
prove the result is non-None, avoiding invalid assertions for falsy
defaults (like an empty defaultdict).

This is a hygienic change with no runtime impact.

Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit 5722e48)
The 'assert metadata' checks in the status module were actually fighting
against our own defaults. Since an empty defaultdict is falsy, these
asserts would blow up the whole command if a single daemon was down
after a mgr restart.

This drops those four grumpy asserts. Now, instead of a traceback,
`ceph osd status` and `ceph fs status` will just show a blank hostname
 or "unknown" version as intended.

The trigger is common in practice: any mgr restart leaves daemons
that are currently down without metadata in daemon_state, since
they never reconnect via MMgrOpen to repopulate it. After such a
restart, `ceph osd status` and `ceph fs status` blow up:
```
  Error EINVAL: Traceback (most recent call last):
    ...
    File ".../status/module.py", line 340, in handle_osd_status
      assert metadata
  AssertionError
```

The bug was introduced in 5ac2901

Fixes: https://tracker.ceph.com/issues/76416
Reported-by: Maximiliano Sandoval <[email protected]>
Signed-off-by: Kefu Chai <[email protected]>
(cherry picked from commit 1c5a739)
@tchaikov tchaikov added this to the tentacle milestone May 17, 2026
@github-actions github-actions Bot added cephfs Ceph File System mgr releng-audit-pass Release engineering: passed backport verification audit. labels May 17, 2026
@yuriw

yuriw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@tchaikov this PR is part of the wip-yuri13-testing integration batch and still needs review approval before it can be merged. Could you request a review or ping a reviewer? Thanks!

@yuriw

yuriw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri13-testing-20260729.211123-tentacle.

@tchaikov
tchaikov requested a review from NitzanMordhai August 4, 2026 03:28
@tchaikov

tchaikov commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@NitzanMordhai hi Nitzan, could you please help review this change?

@tchaikov

tchaikov commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@tchaikov this PR is part of the wip-yuri13-testing integration batch and still needs review approval before it can be merged. Could you request a review or ping a reviewer? Thanks!

thanks @yuriw . just ping'ed @NitzanMordhai

@NitzanMordhai NitzanMordhai 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

@batrick batrick modified the milestones: tentacle, v20.2.5 Aug 21, 2026
@batrick batrick added the releng-audit-queue Release engineering: queued for backport verification audit. label Aug 21, 2026
@github-actions github-actions Bot added releng-audit-pass Release engineering: passed backport verification audit. and removed releng-audit-queue Release engineering: queued for backport verification audit. releng-audit-pass Release engineering: passed backport verification audit. labels Aug 21, 2026
@batrick
batrick merged commit e3cbc3a into ceph:tentacle Aug 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System mgr needs-qa pybind releng-audit-pass Release engineering: passed backport verification audit. wip-yuri13-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants