Blame SOURCES/0001-sysctl-Ignore-non-existent-settings-from-system-sysc.patch

8da745
From fb6d2cc90e09e85586bf5599c298fb01c3f01eee Mon Sep 17 00:00:00 2001
8da745
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
8da745
Date: Wed, 29 May 2019 17:07:55 +0200
8da745
Subject: [PATCH] sysctl: Ignore non-existent settings from system sysctl
8da745
 configs
8da745
MIME-Version: 1.0
8da745
Content-Type: text/plain; charset=UTF-8
8da745
Content-Transfer-Encoding: 8bit
8da745
8da745
Ignore non-existent sysctl settings from the system configuration files
8da745
(/etc/sysctl.conf, etc.). Logging errors about these settings hurts user
8da745
experience, if the non-existent settings are in fact real settings that
8da745
are just temporarily unavailable. For example, the following settings
8da745
(from /usr/lib/sysctl.d/00-system.conf on RHEL-7) are not available until
8da745
the br_netfilter module is loaded. However once that module is loaded,
8da745
it is often desirable to set these, so having them in a RHEL-provided
8da745
configuration file makes sense.
8da745
8da745
net.bridge.bridge-nf-call-ip6tables = 0
8da745
net.bridge.bridge-nf-call-iptables = 0
8da745
net.bridge.bridge-nf-call-arptables = 0
8da745
8da745
This change restores the old behaviour before the recent rewrite of the
8da745
sysctl plugin away from using the 'sysctl' program (running
8da745
'sysctl --system' ignores missing settings).
8da745
8da745
Resolves: rhbz#1714595
8da745
8da745
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
8da745
---
8da745
 tuned/plugins/plugin_sysctl.py | 7 ++++---
8da745
 1 file changed, 4 insertions(+), 3 deletions(-)
8da745
8da745
diff --git a/tuned/plugins/plugin_sysctl.py b/tuned/plugins/plugin_sysctl.py
8da745
index 537c896..13e2eac 100644
8da745
--- a/tuned/plugins/plugin_sysctl.py
8da745
+++ b/tuned/plugins/plugin_sysctl.py
8da745
@@ -133,7 +133,7 @@ def _apply_sysctl_config_line(path, lineno, line):
8da745
 				% (path, lineno))
8da745
 		return
8da745
 	value = value.strip()
8da745
-	_write_sysctl(option, value)
8da745
+	_write_sysctl(option, value, ignore_missing = True)
8da745
 
8da745
 def _get_sysctl_path(option):
8da745
 	return "/proc/sys/%s" % option.replace(".", "/")
8da745
@@ -161,7 +161,7 @@ def _read_sysctl(option):
8da745
 					% (option, str(e)))
8da745
 		return None
8da745
 
8da745
-def _write_sysctl(option, value):
8da745
+def _write_sysctl(option, value, ignore_missing = False):
8da745
 	path = _get_sysctl_path(option)
8da745
 	if os.path.basename(path) in DEPRECATED_SYSCTL_OPTIONS:
8da745
 		log.error("Refusing to set deprecated sysctl option %s"
8da745
@@ -175,7 +175,8 @@ def _write_sysctl(option, value):
8da745
 		return True
8da745
 	except (OSError, IOError) as e:
8da745
 		if e.errno == errno.ENOENT:
8da745
-			log.error("Failed to set sysctl parameter '%s' to '%s', the parameter does not exist"
8da745
+			log_func = log.debug if ignore_missing else log.error
8da745
+			log_func("Failed to set sysctl parameter '%s' to '%s', the parameter does not exist"
8da745
 					% (option, value))
8da745
 		else:
8da745
 			log.error("Failed to set sysctl parameter '%s' to '%s': %s"
8da745
-- 
8da745
2.20.1
8da745