From e8d41ac3bbf1c81099022ba06d4470908d4a95e1 Mon Sep 17 00:00:00 2001 From: Brennan Lamoreaux Date: Tue, 11 Apr 2023 22:07:19 +0000 Subject: [PATCH] plugin_net: expand variables properly plugin_net: expand variables properly When attempting verification for the realtime profile, the following error was observed: ERROR tuned.plugins.plugin_net: unknown channels parameter(s): {'check_net_queue_count'} This seems to be because this line: channels=combined ${f:check_net_queue_count:${netdev_queue_count}} in /usr/lib/tuned/realtime/tuned.conf is not correctly parsed. This should be evaluated out to "channels=combined N", where "${f:check_net_queue_count:${netdev_queue_count}}" is replaced by the value of netdev_queue_count in /etc/tuned/realtime-variables.conf. However, the observed error is becaused this line is split on delimiters such as ':', and the whole thing gets jumbled up - instead of evaluating the function to a number. We fix can this issue by properly evaluating config file functions in plugin_net.py. Signed-off-by: Brennan Lamoreaux --- tuned/plugins/plugin_net.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tuned/plugins/plugin_net.py b/tuned/plugins/plugin_net.py index 1cc7b17..105646b 100644 --- a/tuned/plugins/plugin_net.py +++ b/tuned/plugins/plugin_net.py @@ -329,6 +329,8 @@ class NetTuningPlugin(hotplug.Plugin): # parse features/coalesce config parameters (those defined in profile configuration) # context is for error message def _parse_config_parameters(self, value, context): + # expand config variables + value = self._variables.expand(value) # split supporting various dellimeters v = str(re.sub(r"(:\s*)|(\s+)|(\s*;\s*)|(\s*,\s*)", " ", value)).split() lv = len(v)