Repository navigation
cephadm: add a more generic daemon_to_container function - #54424
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
fb48843 to
5de518a
Compare
699d2dc to
f2ef63f
Compare
Use the CustomContainer.create classmethod like most other blocks of code in the get_container function. Signed-off-by: John Mulligan <[email protected]>
This prevents a test failure in future refactoring changes. Signed-off-by: John Mulligan <[email protected]>
In get_container, convert calls to get_container_binds and get_container_mounts to direct uses of the ContainerDaemonForm customize methods, avoiding constructing said ContainerDaemonForm subclasses redundantly. This is all done in one pass because the _update_podman_mounts function is called by get_container_mounts and trying to convert each type at a time would result in extra calls to that function. Signed-off-by: John Mulligan <[email protected]>
Add the function daemon_to_container in the container_daemon_form.py function. This function is roughly equivalent to `get_container` in cephadm.py but entirely relies on subclasses implementing ContainerDaemonForm methods and avoids special casing of daemon types. It duplicates the functionality provided by functions in cephadm.py with regards to special podman specific behaviors. I feel that this is a minor issue because due to recent refactoring those functions are now the one- or two-liners that are copied here. I gated them behind arguments `auto_podman_mounts` and `auto_podman_args` that default to true in order to make the function more reusable - however I don't need them that way and if it seems like extra complexity for no win, we can remove them later. Signed-off-by: John Mulligan <[email protected]>
Switch the ceph daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the snmp daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the monitoring daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the nfs daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the iscsi daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the nvmeof daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the ceph exporter daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the haproxy daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the keepalived daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
Switch the tracing daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
…ction Switch the custom container daemon type class to call daemon_to_container instead of get_container in the class's container method. This breaks a dependency loop between the class and the get_container function hopefully enabling future clean ups and code moves. Signed-off-by: John Mulligan <[email protected]>
With get_container basically equivalent to daemon_to_container except one creates a ContainerDaemonForm and the other requires one, we can rework get_container to act as a thin wrapper around daemon_to_container. Signed-off-by: John Mulligan <[email protected]>
f2ef63f to
8e08d3c
Compare
Remove the call to get_container from the iscsi class's get_tcmu_runner_container method, replacing it with a call to the daemon_to_container function. While they're roughly equivalent - we can consider get_container legacy and only for use in cephadm.py where daemon_to_container is more general. Signed-off-by: John Mulligan <[email protected]>
8e08d3c to
a4e7f35
Compare
|
Lots of failures, but 14/18 are just infra/teuthology issues caused by Other than that, 5 failures
Overall, should only block merging for two PRs causing new failures. |
adk3798
left a comment
There was a problem hiding this comment.
LGTM, one comment but I wouldn't block merging over it. I'm okay with the auto_podman... stuff as well. I think it's nice to have the option there even if there isn't a use case for it yet.
| host_network=host_network, | ||
| daemon = daemon_form_create(ctx, ident) | ||
| assert isinstance(daemon, ContainerDaemonForm) | ||
| privileged = ident.daemon_type in {'mon', 'osd', CephIscsi.daemon_type} |
There was a problem hiding this comment.
NIT, but I think it would be nice to standardize the list of daemon types that need to run with --privileged. There's another spot in this PR that says
privileged = self.identity.daemon_type in ['mon', 'osd']
which already doesn't include the ISCSI daemon type as this set does here. If we had one constant somewhere that listed all the types that need it, we could just reference it whenever needed.
There was a problem hiding this comment.
Good point. I generally feel that this knowledge should be kept within each ContainerDaemonForm class but I was already running out of energy to "refactor all the things".
There was a problem hiding this comment.
That said, I think this PR is OK as is as these kinds of improvements can be done later.
Depends on #54403
Complete the conversion effort started in #54403 by adding a new daemon_to_container function that works similarly to how
get_containerworked but in a class based and much more uniform way.By using daemon_to_container instead of get_container within the daemon type classes we break the last major (there could be some minor ones lingering) circular dependency that prevents us from moving the deamon type classes to files in cephadmlib.
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
opened tracker ticketShow available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e