From: Sebastian Wagner Date: Wed, 10 Nov 2021 12:46:48 +0000 (+0100) Subject: mgr/cephadm: check_for_moved_osds: don't run post_remove X-Git-Tag: v17.1.0~421^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43095%2Fhead;p=ceph.git mgr/cephadm: check_for_moved_osds: don't run post_remove Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index c8e81793da97..80de87d404ce 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -536,7 +536,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: @@ -1136,7 +1136,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 """ @@ -1161,8 +1161,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) diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index a3a81f994648..0e6a46e737df 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -126,6 +126,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): @@ -966,6 +967,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", [