]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: check_for_moved_osds: verify OSDs are up
authorSebastian Wagner <sewagner@redhat.com>
Thu, 9 Sep 2021 11:29:56 +0000 (13:29 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Wed, 10 Nov 2021 12:49:24 +0000 (13:49 +0100)
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 9959249e43c5558948ae27e4d80ebf1470721e86..aaa1610d9c9e6b54b79360fbff5ecbf7c8878c54 100644 (file)
@@ -2105,6 +2105,15 @@ Then run the following:
                 r[str(osd_id)] = o.get('uuid', '')
         return r
 
+    def get_osd_by_id(self, osd_id: int) -> Optional[Dict[str, Any]]:
+        osd = [x for x in self.get('osd_map')['osds']
+               if x['osd'] == osd_id]
+
+        if len(osd) != 1:
+            return None
+
+        return osd[0]
+
     def _trigger_preview_refresh(self,
                                  specs: Optional[List[DriveGroupSpec]] = None,
                                  service_name: Optional[str] = None,
index 10974780d8d07fd558299ee39e4722bdaa0ff5c9..c8e81793da97cb6abf814c72bd3240d517346002 100644 (file)
@@ -521,7 +521,7 @@ class CephadmServe:
         for dd in self.mgr.cache.get_daemons_by_type('osd'):
             assert dd.daemon_id
             all_osds[int(dd.daemon_id)].append(dd)
-        for dds in all_osds.values():
+        for osd_id, dds in all_osds.items():
             if len(dds) <= 1:
                 continue
             running = [dd for dd in dds if dd.status == DaemonDescriptionStatus.running]
@@ -530,6 +530,9 @@ class CephadmServe:
             logger.info(msg)
             if len(running) != 1:
                 continue
+            osd = self.mgr.get_osd_by_id(osd_id)
+            if not osd or not osd['up']:
+                continue
             for e in error:
                 assert e.hostname
                 try:
index 714fc7d0eef937507a1e0e8eacf1872d1fc99ace..4db0b413380a63df2b90b6d1e9add4324c90db15 100644 (file)
@@ -75,6 +75,7 @@ def with_osd_daemon(cephadm_module: CephadmOrchestrator, _run_cephadm, host: str
             {
                 'osd': 1,
                 'up_from': 0,
+                'up': True,
                 'uuid': 'uuid'
             }
         ]