Fixed disk plugin to correctly match devices with python3

This commit is contained in:
Jaroslav Škarvada 2019-01-25 01:48:40 +01:00
parent 54b7496b5f
commit 4cdd08f73c
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 2cc3d747986837d7e7957f5a4baede2dd691348a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Date: Thu, 24 Jan 2019 16:28:24 +0100
Subject: [PATCH] plugin_disk: Fix checking the 'removable' attribute on
python3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
tuned/plugins/plugin_disk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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"])
--
2.20.1

View File

@ -32,7 +32,7 @@
Summary: A dynamic adaptive system tuning daemon
Name: tuned
Version: 2.10.0
Release: 5%{?prerel1}%{?dist}
Release: 6%{?prerel1}%{?dist}
License: GPLv2+
Source0: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel2}.tar.gz
URL: http://www.tuned-project.org/
@ -63,6 +63,8 @@ Patch1: 0001-tuned-adm-Fix-a-traceback-when-run-without-action-sp.patch
Patch2: tuned-2.10.0-makefile-full-python-path.patch
# Upstream patch:
Patch3: 0001-tuned-gui-Sort-plugins-based-on-their-name.patch
# Upstream patch
Patch4: 0001-plugin_disk-Fix-checking-the-removable-attribute-on-.patch
%description
The tuned package contains a daemon that tunes system settings dynamically.
@ -211,6 +213,7 @@ It can be also used to fine tune your system for specific scenarios.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
@ -443,6 +446,9 @@ fi
%{_mandir}/man7/tuned-profiles-compat.7*
%changelog
* Fri Jan 25 2019 Jaroslav Škarvada <jskarvad@redhat.com> - 2.10.0-6
- Fixed disk plugin to correctly match devices with python3
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.10.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild