Skip to content

cephadm: isolate mounts code in methods - #54387

Merged
adk3798 merged 4 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-isolate-mounts-code
Nov 9, 2023
Merged

adk3798 merged 4 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-isolate-mounts-code

Conversation

@phlogistonjohn

Copy link
Copy Markdown
Contributor

Minor cleanups and a move of inline-logic from the get_container_mounts function for ceph and monitoring daemon types.
This greatly simplifies get_container_mounts and will be used as a basis for future refacotring.

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 refactoring
    • 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

The _get_container_mounts_for_type method is only useful for ceph based
daemon types. There's no need to call this method in a universal
context.

Signed-off-by: John Mulligan <[email protected]>
The get_container_mounts method on CephExporter is never called.
Remove it.

Signed-off-by: John Mulligan <[email protected]>
Move the code in an if-block for ceph daemon types within get_container_mounts
to a new method of the Ceph type. The logic is moved to a staticmethod
so that it can be reused within the CephExporter type. This can be fixed
up in the future, but currently the staticmethod handles both Ceph and
CephExporter. Both types gain a get_container_mounts for common usage.

Signed-off-by: John Mulligan <[email protected]>
Move the code used to set up mounts for monitoring daemon types to
a method on the Monitoring class.

Signed-off-by: John Mulligan <[email protected]>
@phlogistonjohn
phlogistonjohn requested a review from a team as a code owner November 7, 2023 12:57
Comment thread src/cephadm/cephadm.py
Comment on lines +336 to +341
mounts[
data_dir + '/keyring'
] = '/etc/ceph/ceph.client.%s.%s.keyring' % (
ident.daemon_type,
ident.daemon_id,
)

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.

is this a black format thing? I find this particular little block a bit harder to read than the original line (even if it was overly long). If it's what the tool does though I can live with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. It is a bit unnatural. I think a quick fix would be to move data_dir + '/keyring' to the line above via a variable assignment, and then black ought to make the block less weird looking. I can do that here in this PR or later on in a follow up series. Let me know what you prefer

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.

I don't want to hold off merging this over the formatting, so it can be done in a follow up

@adk3798

adk3798 commented Nov 9, 2023

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/adking-2023-11-08_01:34:19-orch:cephadm-wip-adk-testing-2023-11-07-1631-distro-default-smithi/

8 failures

Shouldn't merge PRs affecting the specific failed tests or things related to them, but a number of other PRs in the run should be okay to merge.

@adk3798
adk3798 merged commit 8fc5d9c into ceph:main Nov 9, 2023
@phlogistonjohn
phlogistonjohn deleted the jjm-cephadm-isolate-mounts-code branch November 9, 2023 19:53
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