cephadm: add daemon_name property to DaemonIdentity

Add a convenience property to DaemonIdentity and DaemonSubIdentity that
produces a name in the ceph daemon naming convention: <type>.<id>.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2023-07-26 19:25:07 -04:00
parent a7458053a4
commit 04423ccd2d

View File

@ -33,6 +33,10 @@ class DaemonIdentity:
def daemon_id(self) -> str:
return self._daemon_id
@property
def daemon_name(self) -> str:
return f'{self.daemon_type}.{self.daemon_id}'
@property
def legacy_container_name(self) -> str:
return 'ceph-%s-%s.%s' % (self.fsid, self.daemon_type, self.daemon_id)
@ -75,6 +79,10 @@ class DaemonSubIdentity(DaemonIdentity):
def subcomponent(self) -> str:
return self._subcomponent
@property
def daemon_name(self) -> str:
return f'{self.daemon_type}.{self.daemon_id}.{self.subcomponent}'
@property
def container_name(self) -> str:
name = f'ceph-{self.fsid}-{self.daemon_type}-{self.daemon_id}-{self.subcomponent}'