From 4acae0a356ba253fae8c1b3f12a7bb3aa3c967a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Thu, 23 Mar 2017 14:01:36 +0100 Subject: [PATCH] Log errors when applying a profile fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Log errors when applying a profile fails and also log explicitly when we're trying to load the previously applied profile. Resolves: rhbz#1434360 Signed-off-by: Ondřej Lysoněk --- tuned/daemon/controller.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tuned/daemon/controller.py b/tuned/daemon/controller.py index 346ca3a..5addcee 100644 --- a/tuned/daemon/controller.py +++ b/tuned/daemon/controller.py @@ -86,6 +86,7 @@ class Controller(tuned.exports.interfaces.ExportableInterface): was_running = self._daemon.is_running() msg = "OK" success = True + reapply = False try: if was_running: # stop(switch_profile = True), due to profile switch @@ -94,8 +95,17 @@ class Controller(tuned.exports.interfaces.ExportableInterface): except tuned.exceptions.TunedException as e: success = False msg = str(e) + if was_running and self._daemon.profile.name == profile_name: + log.error("Failed to reapply profile '%s'. Did it change on disk and break?" % profile_name) + reapply = True + else: + log.error("Failed to apply profile '%s'" % profile_name) finally: if was_running: + if reapply: + log.warn("Applying previously applied (possibly out-dated) profile '%s'." % profile_name) + elif not success: + log.info("Applying previously applied profile.") self._daemon.start() return (success, msg)