Skip to content

mgr/cephadm: add __getstate__ so OSD class can be pickled - #67236

Merged
rkachach merged 1 commit into
ceph:mainfrom
adk3798:cephadm-pickle-osd-class
Feb 25, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
adk3798:cephadm-pickle-osd-class

Conversation

@adk3798

@adk3798 adk3798 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

The OSD class cannot be pickled due to having the
remove_util field which itself cannot be pickled.

2026-02-05T20:30:15.199 INFO:teuthology.orchestra.run.trial079.stderr:+ ceph orch osd rm status
2026-02-05T20:30:15.199 INFO:teuthology.orchestra.run.trial079.stderr:+ grep '^1'
2026-02-05T20:30:15.356 INFO:teuthology.orchestra.run.trial079.stderr:Error EINVAL: Traceback (most recent call last):
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 1975, in _handle_command
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self.CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)  # type: ignore[attr-defined]
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 533, in call
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self.func(mgr, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/cli.py", line 18, in wrapper
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return func(*args, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1612, in _osd_rm_status
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    completion = self.remove_osds_status()
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 1840, in inner
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    completion = self._oremote(method_name, args, kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 1911, in _oremote
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return mgr.remote(o, meth, *args, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 2559, in remote
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self._ceph_dispatch_remote(module_name, method_name,
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:RuntimeError: Remote method threw exception: TypeError: cannot pickle 'CephadmOrchestrator' object

This commit adds a getstate function which should allow pickle to work around this

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@adk3798 adk3798 added the cephadm label Feb 5, 2026
@adk3798
adk3798 requested a review from a team as a code owner February 5, 2026 23:24
@github-actions github-actions Bot added the pybind label Feb 5, 2026
@yaarith yaarith added the needs-tentacle-backport PRs that need tentacle back-port label Feb 6, 2026
@batrick

batrick commented Feb 10, 2026

Copy link
Copy Markdown
Member

jenkins test make check

@batrick

batrick commented Feb 10, 2026

Copy link
Copy Markdown
Member

jenkins test make check arm64

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please create a tracker issue so that this issue can be tracked for backporting.

Then, please annotate the commit which fixes/resolves a Ceph tracker issue with:

Fixes: http://tracker.ceph.com/issues/...

This is essential when examining the history of the repository (this commit fixes what) and helps merge scripts identify issues that have been resolved by a merge. See this article on GitHub on how to amend commits and update your pull request.

The OSD class cannot be pickled due to having the
`remove_util` field which itself cannot be pickled.

```
2026-02-05T20:30:15.199 INFO:teuthology.orchestra.run.trial079.stderr:+ ceph orch osd rm status
2026-02-05T20:30:15.199 INFO:teuthology.orchestra.run.trial079.stderr:+ grep '^1'
2026-02-05T20:30:15.356 INFO:teuthology.orchestra.run.trial079.stderr:Error EINVAL: Traceback (most recent call last):
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 1975, in _handle_command
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self.CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)  # type: ignore[attr-defined]
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 533, in call
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self.func(mgr, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/cli.py", line 18, in wrapper
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return func(*args, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1612, in _osd_rm_status
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    completion = self.remove_osds_status()
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 1840, in inner
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    completion = self._oremote(method_name, args, kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 1911, in _oremote
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return mgr.remote(o, meth, *args, **kwargs)
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:  File "/usr/share/ceph/mgr/mgr_module.py", line 2559, in remote
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:    return self._ceph_dispatch_remote(module_name, method_name,
2026-02-05T20:30:15.357 INFO:teuthology.orchestra.run.trial079.stderr:RuntimeError: Remote method threw exception: TypeError: cannot pickle 'CephadmOrchestrator' object
```

This commit adds a __getstate__ function which should
allow pickle to work around this

Fixes: https://tracker.ceph.com/issues/74862

Signed-off-by: Adam King <[email protected]>
@adk3798
adk3798 force-pushed the cephadm-pickle-osd-class branch from 438329e to 5544880 Compare February 10, 2026 20:59
@adk3798

adk3798 commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

Please create a tracker issue so that this issue can be tracked for backporting.

Then, please annotate the commit which fixes/resolves a Ceph tracker issue with:

Fixes: http://tracker.ceph.com/issues/...

This is essential when examining the history of the repository (this commit fixes what) and helps merge scripts identify issues that have been resolved by a merge. See this article on GitHub on how to amend commits and update your pull request.

apologies, added a tracker link to the commit

@adk3798
adk3798 requested a review from batrick February 10, 2026 21:00
@adk3798

adk3798 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rkachach

Copy link
Copy Markdown
Contributor

This PR has already passed successfully Teuthology testing.

@rkachach
rkachach merged commit eac1c38 into ceph:main Feb 25, 2026
6 checks passed
@rkachach rkachach mentioned this pull request Feb 25, 2026
4 of 14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants