Bug 1944686

Summary: Tuned plugin_net terminates execution if the first listed device returns netlink error
Product: Red Hat Enterprise Linux 8 Reporter: Nitesh Narayan Lal <nilal>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: jeder, jorton, jskarvad, jzerdik, lcapitulino, marjones, mtosatti, pabeni, psklenar
Target Milestone: rcKeywords: Patch, TestCaseNotNeeded, Triaged, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.16.0-0.1.rc1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1945728 (view as bug list) Environment:
Last Closed: 2021-11-09 19:58:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1945728    

Description Nitesh Narayan Lal 2021-03-30 13:48:02 UTC
Description of problem:
If tuned's net  plugin is configured with a list of devices such that the
first one returns ethtool error (Operation not supported), the plugin_net
terminates without parsing the rest of the listed network devices.

Version-Release number of selected component (if applicable):
tuned-2.15.0-2.el8.noarch

How reproducible:
Whenever we have a network device that doesn't support ethtool
configuration and there are other devices after that in the list that do
support ethtool configuration.

Steps to Reproduce:
1. Bring up a rhel8.4 host
2. Apply any tuned profile eg. realtime-virtual-host and configure the
   realtime/tuned.conf with something like:
   [net]
   type=net
   devices=br0,enp5s0f0
   channels=combined ${f:check_net_queue_count:${netdev_queue_count}}
   
   Note:
   To forcefully reproduce this issue I removed the check from tuned where
   it removes virtual devices from the list of network devices. This allows
   the virtual device to return  "Operation not supported" and the
   plugin_net script to fail.
   However, this issue should also be reproducible whenever we have a
   physical network device that doesn't support ethtool configuration.

3. Apply the profile and reboot or after the first reboot.

Actual results:
ERROR    tuned.utils.commands: Executing ethtool error: netlink error: Operation not supported
ERROR    tuned.utils.commands: Executing ethtool error: netlink error: Operation not supported
ERROR    tuned.units.manager: BUG: Unhandled exception in start_tuning: 'NoneType' object has no attribute 'items'
ERROR    tuned.units.manager: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tuned/units/manager.py", line 119, in _try_call
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/instance/instance.py", line 78, in apply_tuning
    self._plugin.instance_apply_tuning(self)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 264, in instance_apply_tuning
    self._instance_apply_static(instance)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 321, in _instance_apply_static
    self._execute_all_device_commands(instance, instance.assigned_devices)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 446, in _execute_all_device_commands
    self._execute_device_command(instance, command, device, new_value)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 507, in _execute_device_command
    command["custom"](True, new_value, device, False, False)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/plugin_net.py", line 475, in _channels
    return self._custom_parameters("channels", start, value, device, verify)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/plugin_net.py", line 436, in _custom_parameters
    in params_current.items()
AttributeError: 'NoneType' object has no attribute 'items'

Expected results:
Tuned should apply the network configuration to remaining devices that
supports it without terminating.

Additional info:
The issue is also reproducible upstream.

Comment 22 errata-xmlrpc 2021-11-09 19:58:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (tuned bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4476