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 <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2023-10-04 13:43:47 -04:00
parent e82baf51be
commit ed1bdff776

View File

@ -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