]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm/services/osd: skip found osds that already have daemons
authorSage Weil <sage@newdream.net>
Mon, 6 Dec 2021 15:19:57 +0000 (10:19 -0500)
committerSage Weil <sage@newdream.net>
Thu, 16 Dec 2021 15:39:52 +0000 (10:39 -0500)
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 <sage@newdream.net>
src/pybind/mgr/cephadm/inventory.py
src/pybind/mgr/cephadm/services/osd.py

index 48e087997a77dde8895c3cba8b3fdc3473dbd511..ee8f164ab47ae2cc80eb8bebe225986437b9e0d2 100644 (file)
@@ -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
index 82282d698b61aeee7b863b291a7bdcfe60b49680..234d7a057c17a6884ee153e3ca9bf1af0281afad 100644 (file)
@@ -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