From dc3d45bbe8c3bfedee57da619616c0be489cd233 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 6 Dec 2021 10:19:57 -0500 Subject: [PATCH] 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 --- src/pybind/mgr/cephadm/inventory.py | 4 ++-- src/pybind/mgr/cephadm/services/osd.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.5