]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: remove call to get_container from iscsi tcmu runner method 54424/head
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 8 Nov 2023 16:54:42 +0000 (11:54 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 17 Nov 2023 13:17:21 +0000 (08:17 -0500)
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 <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 8a1357d3fab0ea98cc76ab225249d9d5e68ad9a6..959676ba3af17be99bc8673a48dadcd4356169e1 100755 (executable)
@@ -1159,15 +1159,12 @@ class CephIscsi(ContainerDaemonForm):
         return cls.daemon_type == daemon_type
 
     def __init__(self,
-                 ctx,
-                 fsid,
-                 daemon_id,
-                 config_json,
-                 image=DEFAULT_IMAGE):
-        # type: (CephadmContext, str, Union[int, str], Dict, str) -> None
+                 ctx: CephadmContext,
+                 ident: DaemonIdentity,
+                 config_json: Dict,
+                 image: str = DEFAULT_IMAGE):
         self.ctx = ctx
-        self.fsid = fsid
-        self.daemon_id = daemon_id
+        self._identity = ident
         self.image = image
 
         # config-json options
@@ -1177,18 +1174,24 @@ class CephIscsi(ContainerDaemonForm):
         self.validate()
 
     @classmethod
-    def init(cls, ctx, fsid, daemon_id):
-        # type: (CephadmContext, str, Union[int, str]) -> CephIscsi
-        return cls(ctx, fsid, daemon_id,
-                   fetch_configs(ctx), ctx.image)
+    def init(cls, ctx: CephadmContext, fsid: str, daemon_id: str) -> 'CephIscsi':
+        return cls.create(ctx, DaemonIdentity(fsid, cls.daemon_type, daemon_id))
 
     @classmethod
     def create(cls, ctx: CephadmContext, ident: DaemonIdentity) -> 'CephIscsi':
-        return cls.init(ctx, ident.fsid, ident.daemon_id)
+        return cls(ctx, ident, fetch_configs(ctx), ctx.image)
 
     @property
     def identity(self) -> DaemonIdentity:
-        return DaemonIdentity(self.fsid, self.daemon_type, self.daemon_id)
+        return self._identity
+
+    @property
+    def fsid(self) -> str:
+        return self._identity.fsid
+
+    @property
+    def daemon_id(self) -> str:
+        return self._identity.daemon_id
 
     @staticmethod
     def _get_container_mounts(data_dir, log_dir):
@@ -1344,8 +1347,9 @@ done
         subident = DaemonSubIdentity(
             self.fsid, self.daemon_type, self.daemon_id, 'tcmu'
         )
+        tcmu_dmn = self.create(self.ctx, subident)
         tcmu_container = to_deployment_container(
-            self.ctx, get_container(self.ctx, subident)
+            self.ctx, daemon_to_container(self.ctx, tcmu_dmn, privileged=True)
         )
         # TODO: Eventually we don't want to run tcmu-runner through this script.
         # This is intended to be a workaround backported to older releases