]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: add func to deploy any generic ContainerDaemonForm
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 23 Sep 2023 19:26:03 +0000 (15:26 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 4 Oct 2023 19:17:57 +0000 (15:17 -0400)
While there are no ContainerDaemonForms implemented yet, add a function
that uses the ContainerDaemonForm methods to construct a deployment
for the container based daemons.

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

index 2b7c8a0a69a8983db6b348654f0e3334354000f6..c40d2f15bbf1c09a5d8c80697de75cad3fa26c23 100755 (executable)
@@ -164,10 +164,12 @@ from cephadmlib.host_facts import HostFacts, list_networks
 from cephadmlib.ssh import authorize_ssh_key, check_ssh_connectivity
 from cephadmlib.daemon_form import (
     DaemonForm,
+    UnexpectedDaemonTypeError,
     create as daemon_form_create,
     register as register_daemon_form,
 )
 from cephadmlib.deploy import DeploymentType
+from cephadmlib.container_daemon_form import ContainerDaemonForm
 from cephadmlib.sysctl import install_sysctl, migrate_sysctl_dir
 from cephadmlib.firewalld import Firewalld, update_firewalld
 
@@ -5257,10 +5259,42 @@ def _dispatch_deploy(
             deployment_type=deployment_type,
             endpoints=daemon_endpoints,
         )
-
     else:
-        raise Error('daemon type {} not implemented in command_deploy function'
-                    .format(daemon_type))
+        try:
+            _deploy_daemon_container(
+                ctx, ident, daemon_endpoints, deployment_type
+            )
+        except UnexpectedDaemonTypeError:
+            raise Error('daemon type {} not implemented in command_deploy function'
+                        .format(daemon_type))
+
+
+def _deploy_daemon_container(
+    ctx: CephadmContext,
+    ident: 'DaemonIdentity',
+    daemon_endpoints: List[EndPoint],
+    deployment_type: DeploymentType,
+) -> None:
+    daemon = daemon_form_create(ctx, ident)
+    assert isinstance(daemon, ContainerDaemonForm)
+    daemon.customize_container_endpoints(daemon_endpoints, deployment_type)
+    ctr = daemon.container(ctx)
+    ics = daemon.init_containers(ctx)
+    config, keyring = daemon.config_and_keyring(ctx)
+    uid, gid = daemon.uid_gid(ctx)
+    deploy_daemon(
+        ctx,
+        ident,
+        ctr,
+        uid,
+        gid,
+        config=config,
+        keyring=keyring,
+        deployment_type=deployment_type,
+        endpoints=daemon_endpoints,
+        osd_fsid=daemon.osd_fsid,
+        init_containers=ics,
+    )
 
 ##################################