File plugin_disk_fix_checking_removable_attribute_on_python3.patch of Package tuned.12921

From: Ondřej Lysoněk <olysonek@redhat.com>
Subject: plugin_disk: Fix checking the 'removable' attribute on python3
References: Bugfix found by git HEAD review
Patch-Mainline: v2.11.0-rc.1
Git-commit: 2cc3d747986837d7e7957f5a4baede2dd691348a
Git-repo: https://github.com/openSUSE/tuned.git

The 'removable' attribute is a bytestring, so it will never be equal to
"0" in python3. Check equality with b"0" instead.

The patch was originally written by Tomáš Korbař.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>

Signed-off-by: Thomas Renninger <trenn@suse.com>

diff --git a/tuned/plugins/plugin_disk.py b/tuned/plugins/plugin_disk.py
index 1de1257..65504d8 100644
--- a/tuned/plugins/plugin_disk.py
+++ b/tuned/plugins/plugin_disk.py
@@ -39,7 +39,7 @@ class DiskPlugin(hotplug.Plugin):
 	@classmethod
 	def _device_is_supported(cls, device):
 		return  device.device_type == "disk" and \
-			device.attributes.get("removable", None) == "0" and \
+			device.attributes.get("removable", None) == b"0" and \
 			(device.parent is None or \
 					device.parent.subsystem in ["scsi", "virtio", "xen"])
 
openSUSE Build Service is sponsored by