fix check for delayacct (#RHEL-16345)

Resolves: #RHEL-16345
This commit is contained in:
Michal Hlavinka 2023-12-11 23:46:13 +01:00
parent 3270125fb0
commit 467da527f5
2 changed files with 46 additions and 9 deletions

View File

@ -0,0 +1,29 @@
diff -up iotop-0.6/iotop/data.py.delayacctcheck iotop-0.6/iotop/data.py
--- iotop-0.6/iotop/data.py.delayacctcheck 2023-12-11 22:15:47.280664665 +0100
+++ iotop-0.6/iotop/data.py 2023-12-11 22:14:16.689868890 +0100
@@ -27,6 +27,7 @@ import stat
import struct
import sys
import time
+from procfs import cmdline
#
# Check for requirements:
@@ -455,8 +456,17 @@ class ProcessList(DumpableObject):
def sysctl_task_delayacct():
+ """ WAS:
try:
with open('/proc/sys/kernel/task_delayacct') as f:
return bool(int(f.read().strip()))
except FileNotFoundError:
return None
+
+
+ Because /proc/sys/kernel/task_delayacct doesn't exist on RHEL8,
+ it always returns None, which is equivalent to False in the end.
+
+ On RHEL8, delayacct_on kernel variable is enabled by default
+ """
+ return 'nodelayacct' not in cmdline().keys()

View File

@ -1,6 +1,6 @@
Name: iotop
Version: 0.6
Release: 17%{?dist}
Release: 18%{?dist}
Summary: Top like utility for I/O
License: GPLv2+
URL: http://guichaz.free.fr/iotop/
@ -25,6 +25,10 @@ Patch6: iotop-0.6-git9c49d59.patch
# rhbz#1679201
Patch7: iotop-0.6-delayacctmsg.patch
# downstream for RHEL8, #RHEL-16345
Patch8: iotop-0.6-delayacctcheck.patch
Requires: python3-linux-procfs
BuildArch: noarch
BuildRequires: python3-devel
@ -36,14 +40,15 @@ show of behalf of which process is the I/O going on.
%prep
%setup -n %{name}-%{version}
%patch0 -p1 -b .noendcurses
%patch1 -p1 -b .python3
%patch2 -p1
%patch3 -p1 -b .batchprintutf8
%patch4 -p1 -b .gitdd4fcc71
%patch5 -p1 -b .gitab35334d
%patch6 -p1 -b .git9c49d59
%patch7 -p1 -b .delayacctmsg
%patch -P 0 -p1 -b .noendcurses
%patch -P 1 -p1 -b .python3
%patch -P 2 -p1
%patch -P 3 -p1 -b .batchprintutf8
%patch -P 4 -p1 -b .gitdd4fcc71
%patch -P 5 -p1 -b .gitab35334d
%patch -P 6 -p1 -b .git9c49d59
%patch -P 7 -p1 -b .delayacctmsg
%patch -P 8 -p1 -b .delayacctcheck
%build
%py3_build
@ -59,6 +64,9 @@ show of behalf of which process is the I/O going on.
%{_mandir}/man8/iotop.*
%changelog
* Mon Dec 11 2023 Michal Hlavinka <mhlavink@redhat.com> - 0.6-18
- fix check for delayacct (#RHEL-16345)
* Mon Feb 14 2022 Michal Hlavinka <mhlavink@redhat.com> - 0.6-17
- do not show DELAY_ACCT error for non-existent pids(#1679201)