Skip to content

Commit ed1bdff

Browse files
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 <[email protected]>
1 parent e82baf5 commit ed1bdff

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/cephadm/cephadm.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3356,7 +3356,8 @@ def handle_json_payload(self, data: Dict[Any, Any]) -> None:
33563356
self.agent.wakeup()
33573357

33583358

3359-
class CephadmAgent():
3359+
@register_daemon_form
3360+
class CephadmAgent(DaemonForm):
33603361

33613362
daemon_type = 'agent'
33623363
default_port = 8498
@@ -3371,6 +3372,18 @@ class CephadmAgent():
33713372
'listener.key',
33723373
]
33733374

3375+
@classmethod
3376+
def for_daemon_type(cls, daemon_type: str) -> bool:
3377+
return cls.daemon_type == daemon_type
3378+
3379+
@classmethod
3380+
def create(cls, ctx: CephadmContext, ident: DaemonIdentity) -> 'CephadmAgent':
3381+
return cls(ctx, ident.fsid, ident.daemon_id)
3382+
3383+
@property
3384+
def identity(self) -> DaemonIdentity:
3385+
return DaemonIdentity(self.fsid, self.daemon_type, self.daemon_id)
3386+
33743387
def __init__(self, ctx: CephadmContext, fsid: str, daemon_id: Union[int, str] = ''):
33753388
self.ctx = ctx
33763389
self.fsid = fsid

0 commit comments

Comments
 (0)