]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: only call get_container_binds on types that have binds
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 20 Oct 2023 17:56:31 +0000 (13:56 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 9 Nov 2023 19:50:46 +0000 (14:50 -0500)
This is a step towards not calling get_container_binds in get_container.
A future commit will replace uses of get_container_binds with direct
uses of common class methods.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index d99af63ddefb5cd6bc187a01ce17560c1a972142..03887b46e6b1d72986827cc45d6e2081299caeba 100755 (executable)
@@ -2770,6 +2770,7 @@ def get_container(
     d_args: List[str] = []
     envs: List[str] = []
     host_network: bool = True
+    binds: List[List[str]] = []
 
     daemon_type = ident.daemon_type
     if daemon_type in ceph_daemons():
@@ -2855,12 +2856,14 @@ def get_container(
         container_args.extend(['--ulimit', 'memlock=-1:-1'])
         container_args.extend(['--ulimit', 'nofile=10240'])
         container_args.extend(['--cap-add=SYS_ADMIN', '--cap-add=CAP_SYS_NICE'])
+        binds = get_container_binds(ctx, ident)
     elif daemon_type == CephIscsi.daemon_type:
         entrypoint = CephIscsi.entrypoint
         name = ident.daemon_name
         # So the container can modprobe iscsi_target_mod and have write perms
         # to configfs we need to make this a privileged container.
         privileged = True
+        binds = get_container_binds(ctx, ident)
     elif daemon_type == CustomContainer.daemon_type:
         cc = CustomContainer.init(ctx, ident.fsid, ident.daemon_id)
         entrypoint = cc.entrypoint or ''
@@ -2868,6 +2871,7 @@ def get_container(
         envs.extend(cc.get_container_envs())
         container_args.extend(cc.get_container_args())
         d_args.extend(cc.get_daemon_args())
+        binds = get_container_binds(ctx, ident)
     elif daemon_type == SNMPGateway.daemon_type:
         sg = SNMPGateway.init(ctx, ident.fsid, ident.daemon_id)
         container_args.append(
@@ -2876,7 +2880,6 @@ def get_container(
         d_args.extend(sg.get_daemon_args())
 
     _update_container_args_for_podman(ctx, ident, container_args)
-    binds = get_container_binds(ctx, ident)
     return CephContainer.for_daemon(
         ctx,
         ident=ident,