From: Adam King Date: Wed, 17 Aug 2022 23:03:18 +0000 (-0400) Subject: mgr/cephadm: don't try to write client/os tuning profiles to known offline hosts X-Git-Tag: v18.0.0~129^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=df3557200dcae2ab1b55acf616b13adfc77fc771;p=ceph.git mgr/cephadm: don't try to write client/os tuning profiles to known offline hosts Fixes: https://tracker.ceph.com/issues/57175 Signed-off-by: Adam King --- diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index c12e751b5f8..e94a58c84b7 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1060,6 +1060,8 @@ class CephadmServe: client_files: Dict[str, Dict[str, Tuple[int, int, int, bytes, str]]], host: str) -> None: updated_files = False + if host in self.mgr.offline_hosts: + return old_files = self.mgr.cache.get_host_client_files(host).copy() for path, m in client_files.get(host, {}).items(): mode, uid, gid, content, digest = m diff --git a/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py b/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py index 41c0d96fcf3..1521b011052 100644 --- a/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py +++ b/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py @@ -55,6 +55,7 @@ class FakeMgr: self.tuned_profiles = TunedProfileStore(self) self.tuned_profiles.profiles = profiles self.ssh = SSHManager(self) + self.offline_hosts = [] def set_store(self, what: str, value: str): raise SaveError(f'{what}: {value}') diff --git a/src/pybind/mgr/cephadm/tuned_profiles.py b/src/pybind/mgr/cephadm/tuned_profiles.py index 7a5ce6fe602..3f617956846 100644 --- a/src/pybind/mgr/cephadm/tuned_profiles.py +++ b/src/pybind/mgr/cephadm/tuned_profiles.py @@ -47,6 +47,8 @@ class TunedProfileUtils(): self._write_tuned_profiles(host, profiles) def _remove_stray_tuned_profiles(self, host: str, profiles: List[Dict[str, str]]) -> None: + if host in self.mgr.offline_hosts: + return cmd = ['ls', SYSCTL_DIR] found_files = self.mgr.ssh.check_execute_command(host, cmd).split('\n') found_files = [s.strip() for s in found_files] @@ -63,6 +65,8 @@ class TunedProfileUtils(): self.mgr.ssh.check_execute_command(host, ['sysctl', '--system']) def _write_tuned_profiles(self, host: str, profiles: List[Dict[str, str]]) -> None: + if host in self.mgr.offline_hosts: + return updated = False for p in profiles: for profile_name, content in p.items():