]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: check_for_moved_osds: don't run post_remove
authorSebastian Wagner <sewagner@redhat.com>
Wed, 10 Nov 2021 12:46:48 +0000 (13:46 +0100)
committerSebastian Wagner <sewagner@redhat.com>
Mon, 3 Jan 2022 13:59:53 +0000 (14:59 +0100)
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 70d27f24f837f2d962ce7d1f2672b0d71f5f2f7a)

src/pybind/mgr/cephadm/serve.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 9ee940cd9b6989c7b35d6424d3087f6d7afb29ee..725c39e191f0bafc35fa33e2705d636db5b3c4f6 100644 (file)
@@ -568,7 +568,7 @@ class CephadmServe:
             for e in error:
                 assert e.hostname
                 try:
-                    self._remove_daemon(e.name(), e.hostname)
+                    self._remove_daemon(e.name(), e.hostname, no_post_remove=True)
                     self.mgr.events.for_daemon(
                         e.name(), 'INFO', f"Removed duplicated daemon on host '{e.hostname}'")
                 except OrchestratorError as ex:
@@ -1125,7 +1125,7 @@ class CephadmServe:
                     self.mgr.cephadm_services[servict_type].post_remove(dd, is_failed_deploy=True)
                 raise
 
-    def _remove_daemon(self, name: str, host: str) -> str:
+    def _remove_daemon(self, name: str, host: str, no_post_remove: bool = False) -> str:
         """
         Remove a daemon
         """
@@ -1150,8 +1150,9 @@ class CephadmServe:
                 self.mgr.cache.rm_daemon(host, name)
             self.mgr.cache.invalidate_host_daemons(host)
 
-            self.mgr.cephadm_services[daemon_type_to_service(
-                daemon_type)].post_remove(daemon, is_failed_deploy=False)
+            if not no_post_remove:
+                self.mgr.cephadm_services[daemon_type_to_service(
+                    daemon_type)].post_remove(daemon, is_failed_deploy=False)
 
             return "Removed {} from host '{}'".format(name, host)
 
index b2d77ab0c78128a3abd1367a232f12ebc8eb578b..c7ac8e626cf44b1bf3e7d1ebd640fcfe680dab3b 100644 (file)
@@ -125,6 +125,7 @@ def with_osd_daemon(cephadm_module: CephadmOrchestrator, _run_cephadm, host: str
     dd = cephadm_module.cache.get_daemon(f'osd.{osd_id}', host=host)
     assert dd.name() == f'osd.{osd_id}'
     yield dd
+    cephadm_module._remove_daemons([(f'osd.{osd_id}', host)])
 
 
 class TestCephadm(object):
@@ -962,6 +963,17 @@ class TestCephadm(object):
                                               "Removed duplicated daemon on host 'host2'"),
                         ]
 
+                        with pytest.raises(AssertionError):
+                            cephadm_module.assert_issued_mon_command({
+                                'prefix': 'auth rm',
+                                'entity': 'osd.1',
+                            })
+
+                cephadm_module.assert_issued_mon_command({
+                    'prefix': 'auth rm',
+                    'entity': 'osd.1',
+                })
+
     @pytest.mark.parametrize(
         "spec",
         [