From d545b13dc1e7568af42a59e9721033813eccb61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Wed, 27 Nov 2019 10:53:03 +0100 Subject: [PATCH] controller: Proceed with reload even if daemon is not running MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To fix rhbz#1774645 and rhbz#1702724, we need to make the `Controller.reload` operation behave the same as a Tuned restart even in the case when Tuned is running but no profile is applied. To achieve that, we must not `return False` from `reload()` when Daemon is not running. I'm not aware of any specific purpose the `return False` could serve, other than perhaps making sure that running reload after `tuned-adm off` does not result in the recommended profile being applied. This case is handled in commit 5d8ef2c0095e9, so I think it should be safe now to drop the `return`. Resolves: rhbz#1774645 Resolves: rhbz#1702724 Signed-off-by: Ondřej Lysoněk --- tuned/daemon/controller.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tuned/daemon/controller.py b/tuned/daemon/controller.py index 5bd4d31..18e0bb6 100644 --- a/tuned/daemon/controller.py +++ b/tuned/daemon/controller.py @@ -132,18 +132,16 @@ class Controller(tuned.exports.interfaces.ExportableInterface): def reload(self, caller = None): if caller == "": return False - if not self._daemon.is_running(): - return False - else: + if self._daemon.is_running(): stop_ok = self.stop() if not stop_ok: return False - try: - self._daemon.reload_profile_config() - except TunedException as e: - log.error("Failed to reload Tuned: %s" % e) - return False - return self.start() + try: + self._daemon.reload_profile_config() + except TunedException as e: + log.error("Failed to reload Tuned: %s" % e) + return False + return self.start() def _switch_profile(self, profile_name, manual): was_running = self._daemon.is_running()