From ed1bdff7767d36292a6728aace3e092d50bbfb0f Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 4 Oct 2023 13:43:47 -0400 Subject: [PATCH] cephadm: convert cephadm agent to a daemon form 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 --- src/cephadm/cephadm.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 8869881de423e..4901abf42cd37 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -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 -- 2.39.5