]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: convert cephadm agent to a daemon form 53621/head
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 4 Oct 2023 17:43:47 +0000 (13:43 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 4 Oct 2023 19:17:57 +0000 (15:17 -0400)
The cephadm agent is a bit special in that it will not be converted
to a ContainerDaemonForm (it is not containerized) but we still want
to have it registered as a DeamonForm so that the deamon_type can be
passed to create and have it resolve correctly.

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

index 8869881de423e06d38084dfb40b4ba545b804789..4901abf42cd37692049d6ddf6b6bad4eda5ffef7 100755 (executable)
@@ -3356,7 +3356,8 @@ class MgrListener(Thread):
             self.agent.wakeup()
 
 
-class CephadmAgent():
+@register_daemon_form
+class CephadmAgent(DaemonForm):
 
     daemon_type = 'agent'
     default_port = 8498
@@ -3371,6 +3372,18 @@ class CephadmAgent():
         'listener.key',
     ]
 
+    @classmethod
+    def for_daemon_type(cls, daemon_type: str) -> bool:
+        return cls.daemon_type == daemon_type
+
+    @classmethod
+    def create(cls, ctx: CephadmContext, ident: DaemonIdentity) -> 'CephadmAgent':
+        return cls(ctx, ident.fsid, ident.daemon_id)
+
+    @property
+    def identity(self) -> DaemonIdentity:
+        return DaemonIdentity(self.fsid, self.daemon_type, self.daemon_id)
+
     def __init__(self, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str] = ''):
         self.ctx = ctx
         self.fsid = fsid