Bug 1670490 - Exception being dropped when adding a disk or a logical volume
Summary: Exception being dropped when adding a disk or a logical volume
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned
Version: 7.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: Robin Hack
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-29 16:33 UTC by Renaud Métrich
Modified: 2019-08-06 13:05 UTC (History)
4 users (show)

Fixed In Version: tuned-2.11.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:04:46 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2201 None None None 2019-08-06 13:05:18 UTC

Description Renaud Métrich 2019-01-29 16:33:54 UTC
Description of problem:

When adding a disk to the system or creating a logical volume, an exception is dropped as shown below:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
2019-01-29 17:18:33,003 INFO     tuned.plugins.hotplug: device 'dm-2' added
2019-01-29 17:18:33,004 INFO     tuned.plugins.hotplug: instance disk: adding new device dm-2
2019-01-29 17:18:33,004 ERROR    tuned.hardware.inventory: Exception occured in event handler of '<tuned.plugins.plugin_disk.DiskPlugin object at 0x7ff560840c50>'.
2019-01-29 17:18:33,004 ERROR    tuned.hardware.inventory: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/tuned/hardware/inventory.py", line 58, in _handle_udev_event
    callback(event, device)
  File "/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.py", line 54, in _hardware_events_callback
    super(DiskPlugin, self)._hardware_events_callback(event, device)
  File "/usr/lib/python2.7/site-packages/tuned/plugins/hotplug.py", line 29, in _hardware_events_callback
    self._add_device(device)
  File "/usr/lib/python2.7/site-packages/tuned/plugins/hotplug.py", line 46, in _add_device
    self._added_device_apply_tuning(instance, device_name)
  File "/usr/lib/python2.7/site-packages/tuned/plugins/plugin_disk.py", line 58, in _added_device_apply_tuning
    instance._load_monitor.add_device(device_name)
  File "/usr/lib/python2.7/site-packages/tuned/monitors/base.py", line 102, in add_device
    assert isinstance(device, str)
AssertionError
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

tuned-2.10.0-6.el7.noarch


How reproducible:

Always


Steps to Reproduce:
1. Add a disk to a VM through hotplugging it or create a logical volume

  # vgcreate vg1 /dev/sdb
  # lvcreate -n vol1 -L 1G vg1


Actual results:

Exception above


Expected results:

No exception and device properly configured by tuned


Additional info:

Instrumenting the code, it appears that the device coming from udev is seen as "unicode" string, which can be seen by adding the log.info() line below:

/usr/lib/python2.7/site-packages/tuned/plugins/hotplug.py:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        def _add_device(self, device):
                device_name = device.sys_name
                log.info("DEVICE TYPE: %s" % type(device_name))
...
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

We then get the following log when creating a logical volume:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
2019-01-29 17:27:37,269 INFO     tuned.plugins.hotplug: device 'dm-3' added
2019-01-29 17:27:37,269 INFO     tuned.plugins.hotplug: DEVICE TYPE: <type 'unicode'>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Later, because of the following line, the assertion fails:

/usr/lib/python2.7/site-packages/tuned/monitors/base.py:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        def add_device(self, device):
                assert isinstance(device, str)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

device.sys_name can probably be converted into a "str", but I'm not completely sure about that:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
        def _add_device(self, device):
                device_name = str(device.sys_name)
...
        def _remove_device(self, device):
                device_name = str(device.sys_name)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 2 Renaud Métrich 2019-01-29 16:39:03 UTC
Doesn't happen with RHEL8 tuned-2.10.0-14.el8.noarch, although code is similar.
Looks like the hotplug code is not called somehow.

Comment 3 Ondřej Lysoněk 2019-01-29 17:01:10 UTC
We're aware of the problem, hotplug is broken. The following commit should fix it:
https://github.com/redhat-performance/tuned/pull/141/commits/941fc6e2ea165a34c7db2949869c597e8c216357

Comment 8 errata-xmlrpc 2019-08-06 13:04:46 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, 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-2019:2201


Note You need to log in before you can comment on or make changes to this bug.