From 7966240c56d6223de7a9d87985a0642c23ef03d5 Mon Sep 17 00:00:00 2001 From: Adam King Date: Wed, 17 Aug 2022 19:03:18 -0400 Subject: [PATCH] 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 (cherry picked from commit df3557200dcae2ab1b55acf616b13adfc77fc771) --- src/pybind/mgr/cephadm/serve.py | 2 ++ src/pybind/mgr/cephadm/tests/test_tuned_profiles.py | 1 + src/pybind/mgr/cephadm/tuned_profiles.py | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 2f26ca70900f..b457202cea9b 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -1057,6 +1057,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 bec433fdcb7c..4fea511d3458 100644 --- a/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py +++ b/src/pybind/mgr/cephadm/tests/test_tuned_profiles.py @@ -52,6 +52,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 f07f8f3e48fb..9d9e6eec2645 100644 --- a/src/pybind/mgr/cephadm/tuned_profiles.py +++ b/src/pybind/mgr/cephadm/tuned_profiles.py @@ -46,6 +46,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] @@ -62,6 +64,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(): -- 2.47.3