From: Sage Weil Date: Mon, 6 Dec 2021 15:19:57 +0000 (-0500) Subject: mgr/cephadm/services/osd: skip found osds that already have daemons X-Git-Tag: v17.1.0~220^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dc3d45bbe8c3bfedee57da619616c0be489cd233;p=ceph-ci.git mgr/cephadm/services/osd: skip found osds that already have daemons If we are trying to deploy new or newly-found osds, we can skip the ones that already have cephadm daemons deployed. Fixes: https://tracker.ceph.com/issues/53491 Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index 48e087997a7..ee8f164ab47 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -825,9 +825,9 @@ class HostCache(): raise orchestrator.OrchestratorError(f'Unable to find {daemon_name} daemon(s)') - def has_daemon(self, daemon_name: str) -> bool: + def has_daemon(self, daemon_name: str, host: Optional[str] = None) -> bool: try: - self.get_daemon(daemon_name) + self.get_daemon(daemon_name, host) except orchestrator.OrchestratorError: return False return True diff --git a/src/pybind/mgr/cephadm/services/osd.py b/src/pybind/mgr/cephadm/services/osd.py index 82282d698b6..234d7a057c1 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -125,6 +125,10 @@ class OSDService(CephService): if osd_id in before_osd_uuid_map and osd_id not in replace_osd_ids: # if it exists but is part of the replacement operation, don't skip continue + if self.mgr.cache.has_daemon(f'osd.{osd_id}', host): + # cephadm daemon instance already exists + logger.debug(f'osd id {osd_id} daemon already exists') + continue if osd_id not in osd_uuid_map: logger.debug('osd id {} does not exist in cluster'.format(osd_id)) continue @@ -162,6 +166,10 @@ class OSDService(CephService): if osd_id in before_osd_uuid_map and osd_id not in replace_osd_ids: # if it exists but is part of the replacement operation, don't skip continue + if self.mgr.cache.has_daemon(f'osd.{osd_id}', host): + # cephadm daemon instance already exists + logger.debug(f'osd id {osd_id} daemon already exists') + continue if osd_id not in osd_uuid_map: logger.debug('osd id {} does not exist in cluster'.format(osd_id)) continue