]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: convert get_deployment_type to to use a DaemonIdentity argument
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 26 Jul 2023 23:50:16 +0000 (19:50 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 11 Sep 2023 19:23:04 +0000 (15:23 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 64390ed20247e031c577e1e4fe032f96ef14e883..f91ba551bba0412a0a1a2a4cb1b1e20fd6b71039 100755 (executable)
@@ -5873,11 +5873,12 @@ def get_deployment_init_containers(
     ]
 
 
-def get_deployment_type(ctx: CephadmContext, daemon_type: str, daemon_id: str) -> DeploymentType:
+def get_deployment_type(
+    ctx: CephadmContext, ident: 'DaemonIdentity',
+) -> DeploymentType:
     deployment_type: DeploymentType = DeploymentType.DEFAULT
     if ctx.reconfig:
         deployment_type = DeploymentType.RECONFIG
-    ident = DaemonIdentity(ctx.fsid, daemon_type, daemon_id)
     (_, state, _) = check_unit(ctx, ident.unit_name)
     if state == 'running' or is_container_running(ctx, CephContainer.for_daemon(ctx, ident, 'bash')):
         # if reconfig was set, that takes priority over redeploy. If
@@ -5955,21 +5956,21 @@ def command_deploy_from(ctx: CephadmContext) -> None:
 
 
 def _common_deploy(ctx: CephadmContext) -> None:
-    daemon_type, daemon_id = ctx.name.split('.', 1)
-    if daemon_type not in get_supported_daemons():
-        raise Error('daemon type %s not recognized' % daemon_type)
+    ident = DaemonIdentity.from_context(ctx)
+    if ident.daemon_type not in get_supported_daemons():
+        raise Error('daemon type %s not recognized' % ident.daemon_type)
 
     lock = FileLock(ctx, ctx.fsid)
     lock.acquire()
 
-    deployment_type = get_deployment_type(ctx, daemon_type, daemon_id)
+    deployment_type = get_deployment_type(ctx, ident)
 
     # Migrate sysctl conf files from /usr/lib to /etc
     migrate_sysctl_dir(ctx, ctx.fsid)
 
     # Get and check ports explicitly required to be opened
     endpoints = fetch_tcp_ports(ctx)
-    _dispatch_deploy(ctx, daemon_type, daemon_id, endpoints, deployment_type)
+    _dispatch_deploy(ctx, ident.daemon_type, ident.daemon_id, endpoints, deployment_type)
 
 
 def _dispatch_deploy(