Skip to content

cephadm: add modules to abstract systemd units and run scripts - #54536

Merged
adk3798 merged 7 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-units-n-scripts
Dec 13, 2023
Merged

adk3798 merged 7 commits into
ceph:mainfrom
phlogistonjohn:jjm-cephadm-units-n-scripts

Conversation

@phlogistonjohn

Copy link
Copy Markdown
Contributor

Depends on #54441

A small assortment of patches to abstract some of cephadm's handling of systemd unit files and unit "run scripts".
This is largely in preparation for adding sidecar containers.

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

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-units-n-scripts branch from e124db4 to 298ed7b Compare November 17, 2023 13:14
@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-units-n-scripts branch 2 times, most recently from 310d094 to ed137a8 Compare November 17, 2023 18:37
@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-units-n-scripts branch from ed137a8 to 03ea84c Compare November 29, 2023 20:14
@github-actions

github-actions Bot commented Dec 4, 2023

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-units-n-scripts branch from 03ea84c to 8be22ea Compare December 4, 2023 15:10
@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

NOTE: I'm moving this PR to ready-for-review but I am still not entirely happy with the changes I need to put in when I re-based after PR 53987 was merged. I had to work around both code conflicts and conceptual conflicts with the new command_unit_install function. I pinged the author of the pr at #53987 (comment) asking about changing how the command works. However I have got no response so far.

I'm still inclined to change that function to require a service name. But I'll also ask for feedback from the team.

@phlogistonjohn
phlogistonjohn marked this pull request as ready for review December 4, 2023 15:20
@phlogistonjohn
phlogistonjohn requested a review from a team as a code owner December 4, 2023 15:20
@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

I put a DNM label on here so I don't forget about what I wrote in #54536 (comment)

@phlogistonjohn

Copy link
Copy Markdown
Contributor Author

command_unit_install has been updated to take --fsid and require -n/--name. This resolves the outstanding task on my end. Make check passes. Removing DNM label, ready for review again.

@github-actions

github-actions Bot commented Dec 9, 2023

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

This is to support generating command lines or shell scripts using
Jinja2 templates in the future.

Signed-off-by: John Mulligan <[email protected]>
Update container engine tests file to use the canonical module for
container engines rather than importing them indirectly from cephadm.py.
This future proofs the test in case the imports in cephadm.py change.

Signed-off-by: John Mulligan <[email protected]>
Continue to modularize cephadm by moving the functions related to
generating systemd unit files to a new module.

Signed-off-by: John Mulligan <[email protected]>
Update systemd unit file tests file to use the canonical module for
systemd units functions rather than importing them indirectly from
cephadm.py.
This future proofs the test in case the imports in cephadm.py
change.

Signed-off-by: John Mulligan <[email protected]>
Add the function update_files to systemd_unit.py to encapsulate and
abstract the details regarding the generation of system unit files.
This will make it simpler in the future to add more advanced systemd
configurations include managing customized unit files and systemd
unit drop-in files.

Some additional work was needed to update the recently added
command_unit_install function. Because the new systemd_unit.update_files
function requires a full daemon identity. The command_unit_install
function now requires a daemon name. In addition, while testing this
change it was found that the function could not have worked as it was
because it required the fsid but neither used the infer_fsid decorator
nor provided a `--fsid` argument. Both were added.

Signed-off-by: John Mulligan <[email protected]>
Add a new file runscripts.py for the lower-level management of scripts
and related files that are invoked by systemd units. This patch ended up
uglier than I desired because there was a bunch of daemon specific logic
that remains in cephadm.py and those functions all needed to be updated
to avoid calling functions that write to the scripts directly.
Now customizations are done by passing a list of commands: these
commands can be either a string that will be literally added to the
scipt, a list that will be quoted and then added to the script, or
a ContainerCommand which is basically a wrapper around the arguments to
_write_container_cmd_to bash.

Signed-off-by: John Mulligan <[email protected]>
@phlogistonjohn
phlogistonjohn force-pushed the jjm-cephadm-units-n-scripts branch from 56ec326 to 4e37eb7 Compare December 10, 2023 15:27
@adk3798

adk3798 commented Dec 10, 2023

Copy link
Copy Markdown
Contributor

jenkins test make check

Comment thread src/cephadm/cephadmlib/runscripts.py Resolved
Comment thread src/cephadm/cephadmlib/runscripts.py Resolved
@adk3798

adk3798 commented Dec 13, 2023

Copy link
Copy Markdown
Contributor

https://pulpito.ceph.com/adking-2023-12-11_04:19:36-orch:cephadm-wip-adk-testing-2023-12-10-1329-distro-default-smithi/

reruns of failed/dead jobs: https://pulpito.ceph.com/adking-2023-12-11_15:11:37-orch:cephadm-wip-adk-testing-2023-12-10-1329-distro-default-smithi/

After reruns: 14 failures, 3 dead jobs

Overall, despite the high raw failure number, we should be able to merge PRs from the run.

@adk3798
adk3798 merged commit 529427c into ceph:main Dec 13, 2023
@phlogistonjohn
phlogistonjohn deleted the jjm-cephadm-units-n-scripts branch December 14, 2023 15:22
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