File reload_profile_configuration_on_SIGHUP.patch of Package tuned.35791
From: Tomas Korbar <tkorbar@redhat.com>
Subject: Reload profile configuration on SIGHUP
References: Bugfix found by git HEAD review
Patch-Mainline: v2.11.0-rc.1
Git-commit: 3fe792ed170a5a1c8c11f09ca539b6c9c4861b4d
Git-repo: https://github.com/openSUSE/tuned.git
tuned will now on reload of daemon read again configuration
files
Resolves: rhbz#1631744
Signed-off-by: Thomas Renninger <trenn@suse.com>
diff --git a/tuned/daemon/controller.py b/tuned/daemon/controller.py
index ac711c9..2b8a70b 100644
--- a/tuned/daemon/controller.py
+++ b/tuned/daemon/controller.py
@@ -134,7 +134,11 @@ class Controller(tuned.exports.interfaces.ExportableInterface):
if not self._daemon.is_running():
return False
else:
- return self.stop() and self.start()
+ stop_ok = self.stop()
+ if not stop_ok:
+ return False
+ self._daemon.reload_profile_config()
+ return self.start()
def _switch_profile(self, profile_name, manual):
was_running = self._daemon.is_running()
diff --git a/tuned/daemon/daemon.py b/tuned/daemon/daemon.py
index f13118b..0a55c2a 100644
--- a/tuned/daemon/daemon.py
+++ b/tuned/daemon/daemon.py
@@ -58,6 +58,10 @@ class Daemon(object):
self._not_used.set()
self._profile_applied = threading.Event()
+ def reload_profile_config(self):
+ """Read configuration files again and load profile according to them"""
+ self._init_profile(None)
+
def _init_profile(self, profile_names):
manual = True
if profile_names is None: