Skip to content

cephadm: break various daemon type classes out to smaller files in cephadmlib - #54441

Merged
adk3798 merged 29 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-breakup
Dec 4, 2023
Merged

adk3798 merged 29 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-breakup

Conversation

@phlogistonjohn

@phlogistonjohn phlogistonjohn commented Nov 9, 2023 •

Copy link
Copy Markdown
Contributor

Depends on #54424

Move the container daemon form sub-classes into files in a cephadmlib.daemons package.
Lots of these moves needed test fixups but none were too bad. Partly because of the new fixture...

I added a new test fixture called funkypatch that makes patching a bit easier when moving code around. See the commit message and docstring for more details about how funkypatch is supposed to work.

This should end the big chunk of refactoring PRs aimed at breaking circular dependencies in cephadm and getting nearer a cleaner more modular cephadm core. After this PR I think I'm going to give pure refactoring PRs a rest for a while.

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
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-breakup branch 2 times, most recently from 5f374ba to b14f798 Compare November 14, 2023 21:28
@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-breakup branch 2 times, most recently from b55d42f to 6029453 Compare November 17, 2023 15:58
@phlogistonjohn
phlogistonjohn marked this pull request as ready for review November 29, 2023 20:16
@phlogistonjohn
phlogistonjohn requested a review from a team as a code owner November 29, 2023 20:16

@adk3798 adk3798 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. Didn't look very closely at parts that moved large blocks of code from one file into another or the formatting commits, so must comments are on the earlier commits.

Comment thread src/cephadm/tests/fixtures.py Resolved
Comment thread src/cephadm/tests/fixtures.py Resolved
Comment thread src/cephadm/tests/fixtures.py Resolved
Comment thread src/cephadm/tests/test_cephadm.py Resolved
Comment thread src/cephadm/tests/test_cephadm.py Resolved
This function is roughly the same as make_var_run only it doesn't rely
on shelling out to the install command. Eventually, it will be used
to replace make_var_run in certain locations.

Signed-off-by: John Mulligan <[email protected]>
@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-breakup branch 2 times, most recently from 4cb2885 to 39036ee Compare November 30, 2023 19:20
This fixture acts like a combination of mock.patch and pytest's
monkeypatch fixture. It has the additional feature of automatically
finding and patching the same object imported in other modules.  If you
have 'from x import y', where y is a function or class, in both a.py and
b.py it will patch both instances (so long as both a and b are already
imported).
This behavior is useful for cephadm because of the heavy use of the
`from x import y` idiom and how cephadm is being actively refactored.

Signed-off-by: John Mulligan <[email protected]>
The test_mon_crush_location test always seems to have me tinkering
with it during refactoring. Re-do the fixtures to use funkpatch instead
of mock.patch and normal monkeypatch. This looks nicer (IMO) and should
avoid having to frequently mess with it when moving functions during future
refactoring.

Signed-off-by: John Mulligan <[email protected]>
Create a deployment_utils module for deployment related functions that
don't have a better home.

Signed-off-by: John Mulligan <[email protected]>
Add a shim function and convert to the use of the FunkyPatcher class in
the test_deploy.py test functions. Use a shim as to not have to change
all the tests (yet).

Signed-off-by: John Mulligan <[email protected]>
Update the test that import dict_get and dict_get_join to use the
context_getters module - the module that actually defines the functions.

Signed-off-by: John Mulligan <[email protected]>
Update tests to import should_log_to_journald from context_getters - the
module that actually defines that function. This makes later refactoring
easier.

Signed-off-by: John Mulligan <[email protected]>
Move the ceph classes (Ceph, OSD, CephExporter) along with a few heavily
linked functions to a new ceph.py file under the daemons dir.

Signed-off-by: John Mulligan <[email protected]>
During the refactor of various daemon type classes some of the tests had
been converted to funkypatch in order to deal with imports occuring over
multiple files. However, this conversion was done piece by piece in
order to make clear what was changing. This left the functions in this
file inconsistent. Change all the remaining function to use funkypatch
for consistency.

Signed-off-by: John Mulligan <[email protected]>
@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@adk3798

adk3798 commented Dec 4, 2023

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/adking-2023-12-01_01:19:02-orch:cephadm-wip-adk-testing-2023-11-30-1735-distro-default-smithi/

All dead jobs and 12 of the 15 failed jobs fall under either some sort of infra issue or https://tracker.ceph.com/issues/63672. Remaining 3 failures are

Overall, nothing to block merging on PRs in the run other than the one adding the jinja2 template.

@adk3798
adk3798 merged commit 1680e46 into ceph:main Dec 4, 2023
@phlogistonjohn
phlogistonjohn deleted the jjm-cephadm-breakup branch December 4, 2023 14:40
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