From 323f857620b0e644b7cdcc018b4ea41b2ba12691 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 (cherry picked from commit dc3d45bbe8c3bfedee57da619616c0be489cd233) Conflicts: src/pybind/mgr/cephadm/services/osd.py --- src/pybind/mgr/cephadm/inventory.py | 4 ++-- src/pybind/mgr/cephadm/services/osd.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py index f6920764fcb94..3edf93f8745ef 100644 --- a/src/pybind/mgr/cephadm/inventory.py +++ b/src/pybind/mgr/cephadm/inventory.py @@ -743,9 +743,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 dc4476b709a1c..5344b47a1a3fe 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -120,6 +120,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