From 90e9a93c731df9f51ed100738ea4b228b8f95e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Mon, 17 Aug 2015 15:09:08 +0200 Subject: [PATCH] plugin_cpu: do not show error if cpupower or x86_energy_perf_policy are missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now only warning is displayed similarly to the hdparm behavior. Signed-off-by: Jaroslav Škarvada --- tuned/plugins/plugin_cpu.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index fc6c568..f6322c7 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -5,6 +5,7 @@ from tuned.utils.commands import commands import os import struct +import errno log = tuned.logs.get() @@ -52,19 +53,19 @@ class CPULatencyPlugin(base.Plugin): } def _check_cpupower(self): - if self._cmd.execute(["cpupower", "frequency-info"])[0] == 0: + if self._cmd.execute(["cpupower", "frequency-info"], no_errors = [errno.ENOENT])[0] == 0: self._has_cpupower = True else: self._has_cpupower = False - log.warning("using sysfs fallback, is cpupower installed?") + log.warning("unable to run cpupower tool, using sysfs fallback, is cpupower installed?") def _check_energy_perf_bias(self): self._has_energy_perf_bias = False - retcode = self._cmd.execute(["x86_energy_perf_policy", "-r"])[0] + retcode = self._cmd.execute(["x86_energy_perf_policy", "-r"], no_errors = [errno.ENOENT])[0] if retcode == 0: self._has_energy_perf_bias = True elif retcode == -1: - log.warning("error executing x86_energy_perf_policy tool, ignoring CPU energy performance bias, is the tool installed?") + log.warning("unable to run x86_energy_perf_policy tool, ignoring CPU energy performance bias, is the tool installed?") else: log.warning("your CPU doesn't support MSR_IA32_ENERGY_PERF_BIAS, ignoring CPU energy performance bias")