Rebase to upstream rteval-3.7
Revert the change to use a newer default kernel Resolves: RHEL-8967 Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
parent
84835c4ec5
commit
d569da167a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
SOURCES/rteval-3.5.tar.xz
|
||||
/rteval-3.5.tar.xz
|
||||
/rteval-3.7.tar.xz
|
||||
|
@ -1,57 +0,0 @@
|
||||
From 0ba98b12775b5394aab2205df29d93439d625cc3 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:35 -0400
|
||||
Subject: [PATCH] Added code to check if the proc/net/if_inet6 file exists
|
||||
while loading IPv6 addresses in the IPv6Addresses class
|
||||
|
||||
Added code to check if the proc/net/if_inet6 file exists while loading IPv6 addresses in the IPv6Addresses class. If it doesn't, then the system has IPv6 disabled, and that chunk of code is passed.
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/newnet.py | 28 ++++++++++++++++------------
|
||||
1 file changed, 16 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/newnet.py b/rteval/sysinfo/newnet.py
|
||||
index 63417d9e59f1..2911400ceb6c 100644
|
||||
--- a/rteval/sysinfo/newnet.py
|
||||
+++ b/rteval/sysinfo/newnet.py
|
||||
@@ -72,19 +72,23 @@ class IPv6Addresses():
|
||||
and a list of ipv6addresses
|
||||
'''
|
||||
MYP = '/proc/net/if_inet6'
|
||||
- with open(MYP, 'r') as f:
|
||||
- mystr = f.readline().strip()
|
||||
- while len(mystr) > 0:
|
||||
- ipv6addr , _, _, _, _, intf = mystr.split()
|
||||
- ipv6addr = compress_iv6(ipv6addr)
|
||||
- if intf == 'lo':
|
||||
- mystr = f.readline().strip()
|
||||
- continue
|
||||
- if intf not in self.data:
|
||||
- self.data[intf] = [ipv6addr]
|
||||
- else:
|
||||
- self.data[intf].append(ipv6addr)
|
||||
+ try:
|
||||
+ with open(MYP, 'r') as f:
|
||||
mystr = f.readline().strip()
|
||||
+ while len(mystr) > 0:
|
||||
+ ipv6addr , _, _, _, _, intf = mystr.split()
|
||||
+ ipv6addr = compress_iv6(ipv6addr)
|
||||
+ if intf == 'lo':
|
||||
+ mystr = f.readline().strip()
|
||||
+ continue
|
||||
+ if intf not in self.data:
|
||||
+ self.data[intf] = [ipv6addr]
|
||||
+ else:
|
||||
+ self.data[intf].append(ipv6addr)
|
||||
+ mystr = f.readline().strip()
|
||||
+ # if IPv6 is disabled, the if_net6 files does not exist, so we can pass
|
||||
+ except FileNotFoundError:
|
||||
+ pass
|
||||
|
||||
class IPv4Addresses():
|
||||
''' Obtains a list of IPv4 addresses from the proc file system '''
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,165 +0,0 @@
|
||||
From 149c119df7c7a8ddfd1abc7a127d536cc0674230 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Tue, 23 Aug 2022 14:57:37 -0400
|
||||
Subject: [PATCH 1/3] rteval: Fix "DMI WARNING" when not running as root
|
||||
|
||||
In some cases it is not necessary to run as root, for example when
|
||||
running -Z (--summarize) to summarize an existing report.
|
||||
|
||||
In such cases we do not want to see the message:
|
||||
** DMI WARNING ** Failed to open memory buffer (/dev/mem): Permission denied
|
||||
|
||||
The fix here is to surpresses that message.
|
||||
|
||||
In addition:
|
||||
- the unused "config" option to DMIinfo.__init__ is removed
|
||||
- A few strings are converted to f-strings
|
||||
- "with" is used to open the xsltfile
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/__init__.py | 6 ++---
|
||||
rteval/sysinfo/dmi.py | 45 +++++++++++++++++++-------------------
|
||||
2 files changed, 26 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py
|
||||
index 0436ebb350d9..a4359382f006 100644
|
||||
--- a/rteval/sysinfo/__init__.py
|
||||
+++ b/rteval/sysinfo/__init__.py
|
||||
@@ -42,7 +42,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology,
|
||||
self.__logger = logger
|
||||
KernelInfo.__init__(self, logger=logger)
|
||||
SystemServices.__init__(self, logger=logger)
|
||||
- dmi.DMIinfo.__init__(self, config, logger=logger)
|
||||
+ dmi.DMIinfo.__init__(self, logger=logger)
|
||||
CPUtopology.__init__(self)
|
||||
OSInfo.__init__(self, logger=logger)
|
||||
cmdlineInfo.__init__(self, logger=logger)
|
||||
@@ -80,8 +80,8 @@ if __name__ == "__main__":
|
||||
cfg.installdir = "."
|
||||
si = SystemInfo(cfg, logger=l)
|
||||
|
||||
- print("\tRunning on %s" % si.get_base_os())
|
||||
- print("\tNUMA nodes: %d" % si.mem_get_numa_nodes())
|
||||
+ print(f"\tRunning on {si.get_base_os()}")
|
||||
+ print(f"\tNUMA nodes: {si.mem_get_numa_nodes()}")
|
||||
print("\tMemory available: %03.2f %s\n" % si.mem_get_size())
|
||||
|
||||
print("\tServices: ")
|
||||
diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py
|
||||
index 80cf3c723b36..5965c128c093 100644
|
||||
--- a/rteval/sysinfo/dmi.py
|
||||
+++ b/rteval/sysinfo/dmi.py
|
||||
@@ -1,6 +1,4 @@
|
||||
#
|
||||
-# dmi.py - class to wrap DMI Table information
|
||||
-#
|
||||
# Copyright 2009 - 2013 Clark Williams <williams@redhat.com>
|
||||
# Copyright 2009 - 2013 David Sommerseth <davids@redhat.com>
|
||||
#
|
||||
@@ -24,6 +22,7 @@
|
||||
# including keys needed to generate an equivalently functional executable
|
||||
# are deemed to be part of the source code.
|
||||
#
|
||||
+""" dmi.py class to wrap DMI Table Information """
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -52,16 +51,18 @@ def ProcessWarnings():
|
||||
if warnings is None:
|
||||
return
|
||||
|
||||
+ ignore1 = '/dev/mem: Permission denied'
|
||||
+ ignore2 = 'No SMBIOS nor DMI entry point found, sorry.'
|
||||
+ ignore3 = 'Failed to open memory buffer (/dev/mem): Permission denied'
|
||||
+ ignore = (ignore1, ignore2, ignore3)
|
||||
for warnline in warnings.split('\n'):
|
||||
# Ignore these warnings, as they are "valid" if not running as root
|
||||
- if warnline == '/dev/mem: Permission denied':
|
||||
- continue
|
||||
- if warnline == 'No SMBIOS nor DMI entry point found, sorry.':
|
||||
+ if warnline in ignore:
|
||||
continue
|
||||
|
||||
# All other warnings will be printed
|
||||
if len(warnline) > 0:
|
||||
- print("** DMI WARNING ** %s" % warnline)
|
||||
+ print(f"** DMI WARNING ** {warnline}")
|
||||
|
||||
dmidecode.clear_warnings()
|
||||
|
||||
@@ -69,8 +70,7 @@ def ProcessWarnings():
|
||||
class DMIinfo:
|
||||
'''class used to obtain DMI info via python-dmidecode'''
|
||||
|
||||
- # TODO: Remove unnecessary config
|
||||
- def __init__(self, config, logger):
|
||||
+ def __init__(self, logger):
|
||||
self.__version = '0.5'
|
||||
|
||||
if not dmidecode_loaded:
|
||||
@@ -83,22 +83,24 @@ class DMIinfo:
|
||||
|
||||
self.__xsltparser = self.__load_xslt('rteval_dmi.xsl')
|
||||
|
||||
- def __load_xslt(self, fname):
|
||||
- xsltfile = None
|
||||
+ @staticmethod
|
||||
+ def __load_xslt(fname):
|
||||
+ xsltf = None
|
||||
if os.path.exists(fname):
|
||||
- xsltfile = open(fname, "r")
|
||||
- elif rtevalConfig.default_config_search([fname], os.path.isfile):
|
||||
- xsltfile = open(rtevalConfig.default_config_search([fname], os.path.isfile), "r")
|
||||
-
|
||||
- if xsltfile:
|
||||
- xsltdoc = lxml.etree.parse(xsltfile)
|
||||
- ret = lxml.etree.XSLT(xsltdoc)
|
||||
- xsltfile.close()
|
||||
+ xsltf = fname
|
||||
+ else:
|
||||
+ xsltf = rtevalConfig.default_config_search([fname], os.path.isfile)
|
||||
+
|
||||
+ if xsltf:
|
||||
+ with open(xsltf, "r") as xsltfile:
|
||||
+ xsltdoc = lxml.etree.parse(xsltfile)
|
||||
+ ret = lxml.etree.XSLT(xsltdoc)
|
||||
return ret
|
||||
|
||||
raise RuntimeError(f'Could not locate XSLT template for DMI data ({fname})')
|
||||
|
||||
def MakeReport(self):
|
||||
+ """ Add DMI information to final report """
|
||||
rep_n = libxml2.newNode("DMIinfo")
|
||||
rep_n.newProp("version", self.__version)
|
||||
if self.__fake:
|
||||
@@ -113,7 +115,7 @@ class DMIinfo:
|
||||
return rep_n
|
||||
|
||||
def unit_test(rootdir):
|
||||
- """ unit_test for dmi.py, looks a little crufty! """
|
||||
+ """ unit_test for dmi.py """
|
||||
|
||||
class UnittestConfigDummy:
|
||||
def __init__(self, rootdir):
|
||||
@@ -132,15 +134,14 @@ def unit_test(rootdir):
|
||||
|
||||
log = Log()
|
||||
log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||
- cfg = UnittestConfigDummy(rootdir)
|
||||
- d = DMIinfo(cfg, log)
|
||||
+ d = DMIinfo(log)
|
||||
dx = d.MakeReport()
|
||||
x = libxml2.newDoc("1.0")
|
||||
x.setRootElement(dx)
|
||||
x.saveFormatFileEnc("-", "UTF-8", 1)
|
||||
return 0
|
||||
except Exception as e:
|
||||
- print("** EXCEPTION: %s" % str(e))
|
||||
+ print(f"** EXCEPTION: {str(e)}")
|
||||
return 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
--
|
||||
2.37.3
|
||||
|
68
Revert-rteval-Change-the-default-kernel.patch
Normal file
68
Revert-rteval-Change-the-default-kernel.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From 47fc74501aa5741fd5dcb2d04aacd857d3d87740 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 25 Oct 2023 10:59:28 -0400
|
||||
Subject: [PATCH] Revert "rteval: Change the default kernel to compile to
|
||||
linux-6.1.8"
|
||||
|
||||
This reverts commit 0f39c69610985b07ce2aa41142d2f0481da8e3a4.
|
||||
|
||||
For RHEL-8.x we want to continue using the same kernel for kcompile
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
Makefile | 2 +-
|
||||
rteval/modules/loads/kcompile.py | 4 ++--
|
||||
rteval/rteval.conf | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index b73e8c13f3e5..176435a8cfd5 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -18,7 +18,7 @@ PREFIX := /usr
|
||||
DATADIR := $(DESTDIR)/$(PREFIX)/share
|
||||
LOADDIR := loadsource
|
||||
|
||||
-KLOAD := $(LOADDIR)/linux-6.1.8.tar.xz
|
||||
+KLOAD := $(LOADDIR)/linux-5.18.1.tar.xz
|
||||
BLOAD := $(LOADDIR)/dbench-4.0.tar.gz
|
||||
LOADS := $(KLOAD) $(BLOAD)
|
||||
|
||||
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
|
||||
index 8be79ce630d5..e531b60754e9 100644
|
||||
--- a/rteval/modules/loads/kcompile.py
|
||||
+++ b/rteval/modules/loads/kcompile.py
|
||||
@@ -20,7 +20,7 @@ expand_cpulist = CpuList.expand_cpulist
|
||||
compress_cpulist = CpuList.compress_cpulist
|
||||
nonisolated_cpulist = CpuList.nonisolated_cpulist
|
||||
|
||||
-DEFAULT_KERNEL_PREFIX = "linux-6.1"
|
||||
+DEFAULT_KERNEL_PREFIX = "linux-5.18"
|
||||
|
||||
class KBuildJob:
|
||||
'''Class to manage a build job bound to a particular node'''
|
||||
@@ -334,7 +334,7 @@ class Kcompile(CommandLineLoad):
|
||||
|
||||
def ModuleParameters():
|
||||
return {"source": {"descr": "Source tar ball",
|
||||
- "default": "linux-6.1.8.tar.xz",
|
||||
+ "default": "linux-5.18.1.tar.xz",
|
||||
"metavar": "TARBALL"},
|
||||
"jobspercore": {"descr": "Number of working threads per core",
|
||||
"default": 2,
|
||||
diff --git a/rteval/rteval.conf b/rteval/rteval.conf
|
||||
index 79e28032dc6b..1a8d0afd2642 100644
|
||||
--- a/rteval/rteval.conf
|
||||
+++ b/rteval/rteval.conf
|
||||
@@ -18,7 +18,7 @@ dbench: external
|
||||
stressng: module
|
||||
|
||||
[kcompile]
|
||||
-source: linux-6.1.8.xz
|
||||
+source: linux-5.18.1.xz
|
||||
jobspercore: 2
|
||||
|
||||
[hackbench]
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,32 +0,0 @@
|
||||
From 33cd1f747596541dc947e14f3dd25ff7960b7443 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Wed, 26 Jul 2023 10:22:12 +0200
|
||||
Subject: [PATCH] rteval: Add missing docstrings in SysTopology
|
||||
|
||||
Add docstrings for isolated_cpus_str and default_cpus_str.
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
---
|
||||
rteval/systopology.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/rteval/systopology.py b/rteval/systopology.py
|
||||
index 19443f9..a991e70 100644
|
||||
--- a/rteval/systopology.py
|
||||
+++ b/rteval/systopology.py
|
||||
@@ -407,10 +407,12 @@ class SysTopology:
|
||||
return cpulist
|
||||
|
||||
def isolated_cpus_str(self):
|
||||
+ """ return a list of strings of numbers of all isolated cpus """
|
||||
cpulist = [str(cpu) for cpu in self.isolated_cpus()]
|
||||
return cpulist
|
||||
|
||||
def default_cpus_str(self):
|
||||
+ """ return a list of strings of numbers of all default schedulable cpus """
|
||||
cpulist = [str(cpu) for cpu in self.default_cpus()]
|
||||
return cpulist
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,54 +0,0 @@
|
||||
From eacf0f1e55fa0e7217133172808bfef2c59242fb Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Thu, 2 Feb 2023 00:47:31 -0500
|
||||
Subject: [PATCH] rteval: Catch failures in python-dmidecode
|
||||
|
||||
python-dmidecode can generate incorrect xml,
|
||||
namely Attribute unit redefined
|
||||
|
||||
Although useful, the dmidecode is not critical to rteval reporting.
|
||||
|
||||
Therefore catch this, and first see if we can at least query the bios.
|
||||
If that works report the bios instead of all, and if that
|
||||
doesn't work, just continue without the dmidecode report.
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/dmi.py | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py
|
||||
index 83f347623b58..89a7faae06b1 100644
|
||||
--- a/rteval/sysinfo/dmi.py
|
||||
+++ b/rteval/sysinfo/dmi.py
|
||||
@@ -79,6 +79,7 @@ class DMIinfo:
|
||||
|
||||
def __init__(self, logger=None):
|
||||
self.__version = '0.6'
|
||||
+ self._log = logger
|
||||
|
||||
if not dmidecode_avail:
|
||||
logger.log(Log.DEBUG, "DMI info unavailable, ignoring DMI tables")
|
||||
@@ -115,7 +116,18 @@ class DMIinfo:
|
||||
rep_n.newProp("not_available", "1")
|
||||
else:
|
||||
self.__dmixml.SetResultType(dmidecode.DMIXML_DOC)
|
||||
- dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all'))
|
||||
+ try:
|
||||
+ dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all'))
|
||||
+ except Exception as ex1:
|
||||
+ self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex1)}, will query BIOS only')
|
||||
+ try:
|
||||
+ # If we can't query 'all', at least query 'bios'
|
||||
+ dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('bios'))
|
||||
+ except Exception as ex2:
|
||||
+ rep_n.addContent("No DMI tables available")
|
||||
+ rep_n.newProp("not_available", "1")
|
||||
+ self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex2)}, dmi info will not be reported')
|
||||
+ return rep_n
|
||||
resdoc = self.__xsltparser(dmiqry)
|
||||
dmi_n = xmlout.convert_lxml_to_libxml2_nodes(resdoc.getroot())
|
||||
rep_n.addChild(dmi_n)
|
||||
--
|
||||
2.39.0
|
||||
|
@ -1,303 +0,0 @@
|
||||
From 9a0b29ceea0ec231208209f3ddcf929c0cf39d3b Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Fri, 23 Jun 2023 13:50:48 -0400
|
||||
Subject: [PATCH] rteval: Changed files to use argparse library instead of
|
||||
optparse
|
||||
|
||||
Replaced optparse.OptionParser() with argparse.ArgumentParser() and optparse.add_options() with argparse.add_arguments().
|
||||
Added/changed code to assign the cmd_opts and cmd_args variables in rteval-cmd correctly to get the -Z/--summarize and
|
||||
-H/--raw-histogram working correctly.
|
||||
Note: the rteval/server files haven't been tested since server is
|
||||
disabled.
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval-cmd | 88 ++++++++++++++++++++++---------------
|
||||
rteval/modules/__init__.py | 12 +++--
|
||||
rteval/rtevalConfig.py | 4 +-
|
||||
server/rteval_testserver.py | 11 ++---
|
||||
server/unittest.py | 8 ++--
|
||||
5 files changed, 70 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/rteval-cmd b/rteval-cmd
|
||||
index 1e6a7fc86baa..70996acce626 100755
|
||||
--- a/rteval-cmd
|
||||
+++ b/rteval-cmd
|
||||
@@ -40,7 +40,7 @@ import os
|
||||
import time
|
||||
import re
|
||||
import shutil
|
||||
-import optparse
|
||||
+import argparse
|
||||
import tempfile
|
||||
import requests
|
||||
import lxml.etree
|
||||
@@ -115,66 +115,84 @@ def parse_options(cfg, parser, cmdargs):
|
||||
# thus they are prefixed with 'rteval___'.
|
||||
# See rteval/rtevalConfig::UpdateFromOptionParser() method for more info
|
||||
#
|
||||
- parser.add_option("-d", "--duration", dest="rteval___duration",
|
||||
- type="string", default=rtevcfg.duration, metavar="DURATION",
|
||||
- help="specify length of test run (default: %default)")
|
||||
- parser.add_option("-v", "--verbose", dest="rteval___verbose",
|
||||
+ parser.add_argument("-d", "--duration", dest="rteval___duration",
|
||||
+ type=str, default=rtevcfg.duration, metavar="DURATION",
|
||||
+ help=f"specify length of test run (default: {rtevcfg.duration})")
|
||||
+ parser.add_argument("-v", "--verbose", dest="rteval___verbose",
|
||||
action="store_true", default=rtevcfg.verbose,
|
||||
- help="turn on verbose prints (default: %default)")
|
||||
- parser.add_option("-q", "--quiet", dest="rteval___quiet",
|
||||
+ help=f"turn on verbose prints (default: {rtevcfg.verbose})")
|
||||
+ parser.add_argument("-q", "--quiet", dest="rteval___quiet",
|
||||
action="store_true", default=rtevcfg.quiet,
|
||||
- help="turn on quiet mode (default: %default)")
|
||||
- parser.add_option("-w", "--workdir", dest="rteval___workdir",
|
||||
- type="string", default=rtevcfg.workdir, metavar="DIRECTORY",
|
||||
- help="top directory for rteval data (default: %default)")
|
||||
- parser.add_option("-l", "--loaddir", dest="rteval___srcdir",
|
||||
- type="string", default=rtevcfg.srcdir, metavar="DIRECTORY",
|
||||
- help="directory for load source tarballs (default: %default)")
|
||||
- parser.add_option("-i", "--installdir", dest="rteval___installdir",
|
||||
- type="string", default=rtevcfg.installdir, metavar="DIRECTORY",
|
||||
- help="place to locate installed templates (default: %default)")
|
||||
- parser.add_option("-s", "--sysreport", dest="rteval___sysreport",
|
||||
+ help=f"turn on quiet mode (default: {rtevcfg.quiet})")
|
||||
+ parser.add_argument("-w", "--workdir", dest="rteval___workdir",
|
||||
+ type=str, default=rtevcfg.workdir, metavar="DIRECTORY",
|
||||
+ help=f"top directory for rteval data (default: {rtevcfg.workdir})")
|
||||
+ parser.add_argument("-l", "--loaddir", dest="rteval___srcdir",
|
||||
+ type=str, default=rtevcfg.srcdir, metavar="DIRECTORY",
|
||||
+ help=f"directory for load source tarballs (default: {rtevcfg.srcdir})")
|
||||
+ parser.add_argument("-i", "--installdir", dest="rteval___installdir",
|
||||
+ type=str, default=rtevcfg.installdir, metavar="DIRECTORY",
|
||||
+ help=f"place to locate installed templates (default: {rtevcfg.installdir})")
|
||||
+ parser.add_argument("-s", "--sysreport", dest="rteval___sysreport",
|
||||
action="store_true", default=rtevcfg.sysreport,
|
||||
- help='run sysreport to collect system data (default: %default)')
|
||||
- parser.add_option("-D", '--debug', dest='rteval___debugging',
|
||||
+ help=f'run sysreport to collect system data (default: {rtevcfg.sysreport})')
|
||||
+ parser.add_argument("-D", '--debug', dest='rteval___debugging',
|
||||
action='store_true', default=rtevcfg.debugging,
|
||||
- help='turn on debug prints (default: %default)')
|
||||
+ help=f'turn on debug prints (default: {rtevcfg.debugging})')
|
||||
#parser.add_option("-X", '--xmlrpc-submit', dest='rteval___xmlrpc',
|
||||
# action='store', default=rtevcfg.xmlrpc, metavar='HOST',
|
||||
# help='Hostname to XML-RPC server to submit reports')
|
||||
#parser.add_option("-P", "--xmlrpc-no-abort", dest="rteval___xmlrpc_noabort",
|
||||
# action='store_true', default=False,
|
||||
# help="Do not abort if XML-RPC server do not respond to ping request");
|
||||
- parser.add_option("-Z", '--summarize', dest='rteval___summarize',
|
||||
+ parser.add_argument("-Z", '--summarize', dest='rteval___summarize',
|
||||
action='store_true', default=False,
|
||||
help='summarize an already existing XML report')
|
||||
- parser.add_option("-H", '--raw-histogram', dest='rteval___rawhistogram',
|
||||
+ parser.add_argument("-H", '--raw-histogram', dest='rteval___rawhistogram',
|
||||
action='store_true', default=False,
|
||||
help='Generate raw histogram data for an already existing XML report')
|
||||
- parser.add_option("-f", "--inifile", dest="rteval___inifile",
|
||||
- type='string', default=None, metavar="FILE",
|
||||
+ parser.add_argument("-f", "--inifile", dest="rteval___inifile",
|
||||
+ type=str, default=None, metavar="FILE",
|
||||
help="initialization file for configuring loads and behavior")
|
||||
- parser.add_option("-a", "--annotate", dest="rteval___annotate",
|
||||
- type="string", default=None, metavar="STRING",
|
||||
+ parser.add_argument("-a", "--annotate", dest="rteval___annotate",
|
||||
+ type=str, default=None, metavar="STRING",
|
||||
help="Add a little annotation which is stored in the report")
|
||||
- parser.add_option("-L", "--logging", dest="rteval___logging",
|
||||
+ parser.add_argument("-L", "--logging", dest="rteval___logging",
|
||||
action='store_true', default=False,
|
||||
help='log the output of the loads in the report directory')
|
||||
- parser.add_option("-O", "--onlyload", dest="rteval___onlyload",
|
||||
+ parser.add_argument("-O", "--onlyload", dest="rteval___onlyload",
|
||||
action='store_true', default=False,
|
||||
help="only run the loads (don't run measurement threads)")
|
||||
- parser.add_option("-V", "--version", dest="rteval___version",
|
||||
+ parser.add_argument("-V", "--version", dest="rteval___version",
|
||||
action='store_true', default=False,
|
||||
help='print rteval version and exit')
|
||||
- parser.add_option("-S", "--source-download", dest="rteval___srcdownload",
|
||||
- type="string", default=None, metavar="KERNEL_VERSION",
|
||||
+ parser.add_argument("-S", "--source-download", dest="rteval___srcdownload",
|
||||
+ type=str, default=None, metavar="KERNEL_VERSION",
|
||||
help='download a source kernel from kernel.org and exit')
|
||||
|
||||
|
||||
if not cmdargs:
|
||||
cmdargs = ["--help"]
|
||||
|
||||
- (cmd_opts, cmd_args) = parser.parse_args(args=cmdargs)
|
||||
+ # if -Z/--summarize is specified, add the files to be summarized to cmd_args, and add -Z to cmd_opts
|
||||
+ cmd_args = []
|
||||
+ if (sys.argv.count('-Z')+sys.argv.count('--summarize')) > 0:
|
||||
+ try:
|
||||
+ ind = cmdargs.index('-Z')
|
||||
+ except ValueError:
|
||||
+ ind = cmdargs.index('--summarize')
|
||||
+ cmd_args = cmdargs[ind+1:]
|
||||
+ cmdargs = cmdargs[:ind+1]
|
||||
+ # if -H/--raw-histogram is specified, add the files to be summarized to cmd_args, and add -Z to cmd_opts
|
||||
+ elif (sys.argv.count('-H')+sys.argv.count('--raw-histogram')) > 0:
|
||||
+ try:
|
||||
+ ind = cmdargs.index('-H')
|
||||
+ except ValueError:
|
||||
+ ind = cmdargs.index('--raw-histogram')
|
||||
+ cmd_args = cmdargs[ind+1:]
|
||||
+ cmdargs = cmdargs[:ind+1]
|
||||
+ cmd_opts = parser.parse_args(args=cmdargs)
|
||||
+
|
||||
if cmd_opts.rteval___version:
|
||||
print(f"rteval version {RTEVAL_VERSION}")
|
||||
sys.exit(0)
|
||||
@@ -196,7 +214,7 @@ def parse_options(cfg, parser, cmdargs):
|
||||
cmd_opts.rteval___duration = float(v) * mult
|
||||
|
||||
# Update the config object with the parsed arguments
|
||||
- cfg.UpdateFromOptionParser(parser)
|
||||
+ cfg.UpdateFromOptionParser(cmd_opts)
|
||||
|
||||
return cmd_args
|
||||
|
||||
@@ -266,7 +284,7 @@ if __name__ == '__main__':
|
||||
measuremods = MeasurementModules(config, logger=logger)
|
||||
|
||||
# parse command line options
|
||||
- parser = optparse.OptionParser()
|
||||
+ parser = argparse.ArgumentParser()
|
||||
loadmods.SetupModuleOptions(parser)
|
||||
measuremods.SetupModuleOptions(parser)
|
||||
cmd_args = parse_options(config, parser, sys.argv[1:])
|
||||
diff --git a/rteval/modules/__init__.py b/rteval/modules/__init__.py
|
||||
index d52dd597186a..253e72abf8aa 100644
|
||||
--- a/rteval/modules/__init__.py
|
||||
+++ b/rteval/modules/__init__.py
|
||||
@@ -25,7 +25,7 @@
|
||||
import time
|
||||
from datetime import datetime
|
||||
import threading
|
||||
-import optparse
|
||||
+import argparse
|
||||
import libxml2
|
||||
from rteval.Log import Log
|
||||
from rteval.rtevalConfig import rtevalCfgSection
|
||||
@@ -294,12 +294,11 @@ the information provided by the module"""
|
||||
def SetupModuleOptions(self, parser, config):
|
||||
"""Sets up a separate optptarse OptionGroup per module with its supported parameters"""
|
||||
|
||||
- grparser = optparse.OptionGroup(parser, "Group Options for %s modules" % self.__modtype)
|
||||
- grparser.add_option('--%s-cpulist' % self.__modtype,
|
||||
+ grparser = parser.add_argument_group("Group Options for %s modules" % self.__modtype)
|
||||
+ grparser.add_argument('--%s-cpulist' % self.__modtype,
|
||||
dest='%s___cpulist' % self.__modtype, action='store', default="",
|
||||
help='CPU list where %s modules will run' % self.__modtype,
|
||||
metavar='LIST')
|
||||
- parser.add_option_group(grparser)
|
||||
|
||||
for (modname, mod) in list(self.__modsloaded.items()):
|
||||
opts = mod.ModuleParameters()
|
||||
@@ -313,7 +312,7 @@ the information provided by the module"""
|
||||
# Ignore if a section is not found
|
||||
cfg = None
|
||||
|
||||
- grparser = optparse.OptionGroup(parser, "Options for the %s module" % shortmod)
|
||||
+ grparser = parser.add_argument_group("Options for the %s module" % shortmod)
|
||||
for (o, s) in list(opts.items()):
|
||||
descr = 'descr' in s and s['descr'] or ""
|
||||
metavar = 'metavar' in s and s['metavar'] or None
|
||||
@@ -328,14 +327,13 @@ the information provided by the module"""
|
||||
default = 'default' in s and s['default'] or None
|
||||
|
||||
|
||||
- grparser.add_option('--%s-%s' % (shortmod, o),
|
||||
+ grparser.add_argument('--%s-%s' % (shortmod, o),
|
||||
dest="%s___%s" % (shortmod, o),
|
||||
action='store',
|
||||
help='%s%s' % (descr,
|
||||
default and ' (default: %s)' % default or ''),
|
||||
default=default,
|
||||
metavar=metavar)
|
||||
- parser.add_option_group(grparser)
|
||||
|
||||
|
||||
def InstantiateModule(self, modname, modcfg, modroot=None):
|
||||
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
|
||||
index 41f1a567720f..ec14a13adcd9 100644
|
||||
--- a/rteval/rtevalConfig.py
|
||||
+++ b/rteval/rtevalConfig.py
|
||||
@@ -286,11 +286,11 @@ class rtevalConfig:
|
||||
return self.__config_files.__contains__(fname)
|
||||
|
||||
|
||||
- def UpdateFromOptionParser(self, parser):
|
||||
+ def UpdateFromOptionParser(self, cmd_opts):
|
||||
"Parse through the command line options and update the appropriate config settings"
|
||||
|
||||
last_sect = None
|
||||
- for sk, v in sorted(vars(parser.values).items()):
|
||||
+ for sk, v in sorted(vars(cmd_opts).items()):
|
||||
# optparse key template: {sectionname}___{key}
|
||||
k = sk.split('___')
|
||||
if k[0] != last_sect:
|
||||
diff --git a/server/rteval_testserver.py b/server/rteval_testserver.py
|
||||
index 3f0c3c73733c..6cac85bcfe52 100644
|
||||
--- a/server/rteval_testserver.py
|
||||
+++ b/server/rteval_testserver.py
|
||||
@@ -31,6 +31,7 @@ import signal
|
||||
from xmlrpc.server import SimpleXMLRPCServer
|
||||
from xmlrpc.server import SimpleXMLRPCRequestHandler
|
||||
from optparse import OptionParser
|
||||
+import argparse
|
||||
|
||||
import xmlrpc_API1
|
||||
from Logger import Logger
|
||||
@@ -110,16 +111,16 @@ rtevalserver = None
|
||||
#
|
||||
|
||||
if __name__ == '__main__':
|
||||
- parser = OptionParser(version="%prog v0.1")
|
||||
+ parser = argparse.ArgumentParser(version="%prog v0.1")
|
||||
|
||||
- parser.add_option("-L", "--listen", action="store", dest="listen", default=LISTEN,
|
||||
+ parser.add_argument("-L", "--listen", action="store", dest="listen", default=LISTEN,
|
||||
help="Which interface to listen to [default: %default]", metavar="IPADDR")
|
||||
- parser.add_option("-P", "--port", action="store", type="int", dest="port", default=PORT,
|
||||
+ parser.add_argument("-P", "--port", action="store", type="int", dest="port", default=PORT,
|
||||
help="Which port to listen to [default: %default]", metavar="PORT")
|
||||
- parser.add_option("-l", "--log", action="store", dest="logfile", default=None,
|
||||
+ parser.add_argument("-l", "--log", action="store", dest="logfile", default=None,
|
||||
help="Where to log requests.", metavar="FILE")
|
||||
|
||||
- (options, args) = parser.parse_args()
|
||||
+ options = parser.parse_args()
|
||||
|
||||
logger = Logger(options.logfile, "RTeval")
|
||||
rtevalserver = RTevald(options, logger)
|
||||
diff --git a/server/unittest.py b/server/unittest.py
|
||||
index 4d53f46590ce..7dcdef08c098 100644
|
||||
--- a/server/unittest.py
|
||||
+++ b/server/unittest.py
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys, threading, time, signal, libxml2
|
||||
-from optparse import OptionParser
|
||||
+import argparse
|
||||
from rteval_testserver import RTevald
|
||||
from Logger import Logger
|
||||
|
||||
@@ -14,10 +14,10 @@ class ServerThread(threading.Thread):
|
||||
self.port = port
|
||||
self.log = Logger('unit-test-server.log','rteval-xmlrpc-testsrv')
|
||||
|
||||
- parser = OptionParser()
|
||||
- parser.add_option("-L", "--listen", action="store", dest="listen", default="127.0.0.1",
|
||||
+ parser = argparse.ArgumentParser()
|
||||
+ parser.add_argument("-L", "--listen", action="store", dest="listen", default="127.0.0.1",
|
||||
help="Which interface to listen to [default: %default]", metavar="IPADDR")
|
||||
- parser.add_option("-P", "--port", action="store", type="int", dest="port", default=self.port,
|
||||
+ parser.add_argument("-P", "--port", action="store", type="int", dest="port", default=self.port,
|
||||
help="Which port to listen to [default: %default]", metavar="PORT")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,98 +0,0 @@
|
||||
From 3206001ad1b42cf6fb97c7848f438d2bdbe843bc Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:02 +0200
|
||||
Subject: [PATCH] rteval: Detect isolcpus in systopology
|
||||
|
||||
Works similarly to online_cpus:
|
||||
- add CpuList.isolated_cpulist to filter isolated CPUs
|
||||
- add SysTopology.isolated_cpus to get list of isolated CPUs
|
||||
- add CpuList.nonisolated_cpulist to do the opposite filter
|
||||
- add SysTopology.default_cpus to get CPUs that are used for scheduling
|
||||
by default, i.e. online and non-isolated CPUs
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/systopology.py | 47 +++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 47 insertions(+)
|
||||
|
||||
diff --git a/rteval/systopology.py b/rteval/systopology.py
|
||||
index c8f85c5..19443f9 100644
|
||||
--- a/rteval/systopology.py
|
||||
+++ b/rteval/systopology.py
|
||||
@@ -127,6 +127,11 @@ class CpuList:
|
||||
return True
|
||||
return False
|
||||
|
||||
+ @staticmethod
|
||||
+ def isolated_file_exists():
|
||||
+ """ Check whether machine / kernel is configured with isolated file """
|
||||
+ return os.path.exists(os.path.join(CpuList.cpupath, "isolated"))
|
||||
+
|
||||
@staticmethod
|
||||
def longest_sequence(cpulist):
|
||||
""" return index of last element of a sequence that steps by one """
|
||||
@@ -214,6 +219,24 @@ class CpuList:
|
||||
newlist.append(cpu)
|
||||
return newlist
|
||||
|
||||
+ @staticmethod
|
||||
+ def isolated_cpulist(cpulist):
|
||||
+ """Given a cpulist, return a cpulist of isolated CPUs"""
|
||||
+ if not CpuList.isolated_file_exists():
|
||||
+ return cpulist
|
||||
+ isolated_cpulist = sysread(CpuList.cpupath, "isolated")
|
||||
+ isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
|
||||
+ return list(set(isolated_cpulist) & set(cpulist))
|
||||
+
|
||||
+ @staticmethod
|
||||
+ def nonisolated_cpulist(cpulist):
|
||||
+ """Given a cpulist, return a cpulist of non-isolated CPUs"""
|
||||
+ if not CpuList.isolated_file_exists():
|
||||
+ return cpulist
|
||||
+ isolated_cpulist = sysread(CpuList.cpupath, "isolated")
|
||||
+ isolated_cpulist = CpuList.expand_cpulist(isolated_cpulist)
|
||||
+ return list(set(cpulist).difference(set(isolated_cpulist)))
|
||||
+
|
||||
#
|
||||
# class to abstract access to NUMA nodes in /sys filesystem
|
||||
#
|
||||
@@ -362,11 +385,35 @@ class SysTopology:
|
||||
cpulist.sort()
|
||||
return cpulist
|
||||
|
||||
+ def isolated_cpus(self):
|
||||
+ """ return a list of integers of all isolated cpus """
|
||||
+ cpulist = []
|
||||
+ for n in self.nodes:
|
||||
+ cpulist += CpuList.isolated_cpulist(self.getcpus(n))
|
||||
+ cpulist.sort()
|
||||
+ return cpulist
|
||||
+
|
||||
+ def default_cpus(self):
|
||||
+ """ return a list of integers of all default schedulable cpus, i.e. online non-isolated cpus """
|
||||
+ cpulist = []
|
||||
+ for n in self.nodes:
|
||||
+ cpulist += CpuList.nonisolated_cpulist(self.getcpus(n))
|
||||
+ cpulist.sort()
|
||||
+ return cpulist
|
||||
+
|
||||
def online_cpus_str(self):
|
||||
""" return a list of strings of numbers of all online cpus """
|
||||
cpulist = [str(cpu) for cpu in self.online_cpus()]
|
||||
return cpulist
|
||||
|
||||
+ def isolated_cpus_str(self):
|
||||
+ cpulist = [str(cpu) for cpu in self.isolated_cpus()]
|
||||
+ return cpulist
|
||||
+
|
||||
+ def default_cpus_str(self):
|
||||
+ cpulist = [str(cpu) for cpu in self.default_cpus()]
|
||||
+ return cpulist
|
||||
+
|
||||
def invert_cpulist(self, cpulist):
|
||||
""" return a list of online cpus not in cpulist """
|
||||
return [c for c in self.online_cpus() if c not in cpulist]
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,169 +0,0 @@
|
||||
From bce23ecc5d8bb6cab86843f7a42164ee44ef091f Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Thu, 27 Oct 2022 11:14:27 -0400
|
||||
Subject: [PATCH 3/3] rteval: Don't attempt to get DMIinfo if there are dmi
|
||||
warnings
|
||||
|
||||
If the python module dmidecode is available, but produces warnings,
|
||||
you can get a traceback. This happens on some arm boxes,
|
||||
as shown in the traceback below.
|
||||
|
||||
Fix this by treating any warnings that are not listed in the
|
||||
ignorable warnings as if dmi info is not available.
|
||||
|
||||
Also add logging to dmi.ProcessWarnings()
|
||||
|
||||
./rteval-cmd -d10s
|
||||
** DMI WARNING ** /sys/firmware/efi/systab: SMBIOS entry point missing
|
||||
got system topology: 1 node system (4 cores per node)
|
||||
rteval run on 5.19.16-200.fc36.aarch64 started at Fri Oct 21 16:11:51 2022
|
||||
started 3 loads on 4 cores
|
||||
started measurement threads on 4 cores
|
||||
Run duration: 10.0 seconds
|
||||
stopping run at Fri Oct 21 16:13:26 2022
|
||||
Traceback (most recent call last):
|
||||
File "/root/src/rteval/./rteval-cmd", line 402, in <module>
|
||||
ec = rteval.Measure()
|
||||
File "/root/src/rteval/rteval/__init__.py", line 286, in Measure
|
||||
self._report(measure_start, self.__rtevcfg.xslt_report)
|
||||
File "/root/src/rteval/rteval/rtevalReport.py", line 76, in _report
|
||||
self.__xmlreport.AppendXMLnodes(self._sysinfo.MakeReport())
|
||||
File "/root/src/rteval/rteval/sysinfo/__init__.py", line 69, in MakeReport
|
||||
report_n.addChild(dmi.DMIinfo.MakeReport(self))
|
||||
File "/root/src/rteval/rteval/sysinfo/dmi.py", line 111, in MakeReport
|
||||
dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all'))
|
||||
File "/usr/lib64/python3.10/site-packages/dmidecode.py", line 64, in QuerySection
|
||||
ret = libxml2.xmlDoc( _obj = xmlapi(query_type='s',
|
||||
RuntimeError: [src/dmidecodemodule.c:331] Error decoding DMI data
|
||||
|
||||
** COLLECTED WARNINGS **
|
||||
/sys/firmware/efi/systab: SMBIOS entry point missing
|
||||
** END OF WARNINGS **
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval-cmd | 4 ++--
|
||||
rteval/sysinfo/__init__.py | 2 +-
|
||||
rteval/sysinfo/dmi.py | 34 +++++++++++++++++++++-------------
|
||||
3 files changed, 24 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/rteval-cmd b/rteval-cmd
|
||||
index 6a928362828f..1e6a7fc86baa 100755
|
||||
--- a/rteval-cmd
|
||||
+++ b/rteval-cmd
|
||||
@@ -210,8 +210,6 @@ def remove_offline(cpulist):
|
||||
if __name__ == '__main__':
|
||||
from rteval.sysinfo import dmi
|
||||
|
||||
- dmi.ProcessWarnings()
|
||||
-
|
||||
# set LD_BIND_NOW to resolve shared library symbols
|
||||
# note: any string will do, nothing significant about 'rteval'
|
||||
|
||||
@@ -261,6 +259,8 @@ if __name__ == '__main__':
|
||||
| (rtevcfg.debugging and Log.DEBUG)
|
||||
logger.SetLogVerbosity(loglev)
|
||||
|
||||
+ dmi.ProcessWarnings(logger=logger)
|
||||
+
|
||||
# Load modules
|
||||
loadmods = LoadModules(config, logger=logger)
|
||||
measuremods = MeasurementModules(config, logger=logger)
|
||||
diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py
|
||||
index bb1d00810856..5767e5b7f6fe 100644
|
||||
--- a/rteval/sysinfo/__init__.py
|
||||
+++ b/rteval/sysinfo/__init__.py
|
||||
@@ -49,7 +49,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology,
|
||||
NetworkInfo.__init__(self, logger=logger)
|
||||
|
||||
# Parse initial DMI decoding errors
|
||||
- dmi.ProcessWarnings()
|
||||
+ dmi.ProcessWarnings(logger=logger)
|
||||
|
||||
# Parse CPU info
|
||||
CPUtopology._parse(self)
|
||||
diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py
|
||||
index 5965c128c093..83f347623b58 100644
|
||||
--- a/rteval/sysinfo/dmi.py
|
||||
+++ b/rteval/sysinfo/dmi.py
|
||||
@@ -1,6 +1,7 @@
|
||||
#
|
||||
# Copyright 2009 - 2013 Clark Williams <williams@redhat.com>
|
||||
# Copyright 2009 - 2013 David Sommerseth <davids@redhat.com>
|
||||
+# Copyright 2022 John Kacur <jkacur@redhat.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -34,14 +35,19 @@ from rteval import rtevalConfig
|
||||
|
||||
try:
|
||||
import dmidecode
|
||||
- dmidecode_loaded = True
|
||||
+ dmidecode_avail = True
|
||||
except ModuleNotFoundError:
|
||||
- dmidecode_loaded = False
|
||||
+ dmidecode_avail = False
|
||||
|
||||
-def ProcessWarnings():
|
||||
+def set_dmidecode_avail(val):
|
||||
+ """ Used to set global variable dmidecode_avail from a function """
|
||||
+ global dmidecode_avail
|
||||
+ dmidecode_avail = val
|
||||
+
|
||||
+def ProcessWarnings(logger=None):
|
||||
""" Process Warnings from dmidecode """
|
||||
|
||||
- if not dmidecode_loaded:
|
||||
+ if not dmidecode_avail:
|
||||
return
|
||||
|
||||
if not hasattr(dmidecode, 'get_warnings'):
|
||||
@@ -62,7 +68,8 @@ def ProcessWarnings():
|
||||
|
||||
# All other warnings will be printed
|
||||
if len(warnline) > 0:
|
||||
- print(f"** DMI WARNING ** {warnline}")
|
||||
+ logger.log(Log.DEBUG, f"** DMI WARNING ** {warnline}")
|
||||
+ set_dmidecode_avail(False)
|
||||
|
||||
dmidecode.clear_warnings()
|
||||
|
||||
@@ -70,11 +77,11 @@ def ProcessWarnings():
|
||||
class DMIinfo:
|
||||
'''class used to obtain DMI info via python-dmidecode'''
|
||||
|
||||
- def __init__(self, logger):
|
||||
- self.__version = '0.5'
|
||||
+ def __init__(self, logger=None):
|
||||
+ self.__version = '0.6'
|
||||
|
||||
- if not dmidecode_loaded:
|
||||
- logger.log(Log.DEBUG|Log.WARN, "No dmidecode module found, ignoring DMI tables")
|
||||
+ if not dmidecode_avail:
|
||||
+ logger.log(Log.DEBUG, "DMI info unavailable, ignoring DMI tables")
|
||||
self.__fake = True
|
||||
return
|
||||
|
||||
@@ -127,14 +134,15 @@ def unit_test(rootdir):
|
||||
self.__dict__[k] = self.config[k]
|
||||
|
||||
try:
|
||||
- ProcessWarnings()
|
||||
+ log = Log()
|
||||
+ log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||
+
|
||||
+ ProcessWarnings(logger=log)
|
||||
if os.getuid() != 0:
|
||||
print("** ERROR ** Must be root to run this unit_test()")
|
||||
return 1
|
||||
|
||||
- log = Log()
|
||||
- log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||
- d = DMIinfo(log)
|
||||
+ d = DMIinfo(logger=log)
|
||||
dx = d.MakeReport()
|
||||
x = libxml2.newDoc("1.0")
|
||||
x.setRootElement(dx)
|
||||
--
|
||||
2.37.3
|
||||
|
@ -1,52 +0,0 @@
|
||||
From 2db552584b292d8a0d030c5d0e3a0a5cdc8af7cc Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:04 +0200
|
||||
Subject: [PATCH] rteval: Exclude isolcpus from kcompile by default
|
||||
|
||||
Allows correct calculation of make job count that does not include
|
||||
isolated CPUs, on which the loads won't be scheduled.
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/modules/loads/kcompile.py | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
|
||||
index 9244246..316791e 100644
|
||||
--- a/rteval/modules/loads/kcompile.py
|
||||
+++ b/rteval/modules/loads/kcompile.py
|
||||
@@ -37,6 +37,7 @@ from rteval.systopology import CpuList, SysTopology
|
||||
|
||||
expand_cpulist = CpuList.expand_cpulist
|
||||
compress_cpulist = CpuList.compress_cpulist
|
||||
+nonisolated_cpulist = CpuList.nonisolated_cpulist
|
||||
|
||||
DEFAULT_KERNEL_PREFIX = "linux-5.18"
|
||||
|
||||
@@ -55,17 +56,20 @@ class KBuildJob:
|
||||
if not os.path.isdir(self.objdir):
|
||||
os.mkdir(self.objdir)
|
||||
|
||||
+ # Exclude isolated CPUs if cpulist not set
|
||||
+ cpus_available = len(nonisolated_cpulist(self.node.cpus.cpulist))
|
||||
+
|
||||
if os.path.exists('/usr/bin/numactl') and not cpulist:
|
||||
# Use numactl
|
||||
self.binder = f'numactl --cpunodebind {int(self.node)}'
|
||||
- self.jobs = self.calc_jobs_per_cpu() * len(self.node)
|
||||
+ self.jobs = self.calc_jobs_per_cpu() * cpus_available
|
||||
elif cpulist:
|
||||
# Use taskset
|
||||
self.jobs = self.calc_jobs_per_cpu() * len(cpulist)
|
||||
self.binder = f'taskset -c {compress_cpulist(cpulist)}'
|
||||
else:
|
||||
# Without numactl calculate number of jobs from the node
|
||||
- self.jobs = self.calc_jobs_per_cpu() * len(self.node)
|
||||
+ self.jobs = self.calc_jobs_per_cpu() * cpus_available
|
||||
|
||||
self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
|
||||
self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 1afab85c9aa0795af2ce96e1c6a2ccbe3ccec4b5 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:07 +0200
|
||||
Subject: [PATCH] rteval: Exclude isolcpus from loads report
|
||||
|
||||
Use SysTopology.default_cpus() to report cores on which measurements and
|
||||
loads and run by default to reflect the default behavior (no isolcpus).
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
---
|
||||
rteval/modules/loads/__init__.py | 2 +-
|
||||
rteval/modules/measurement/__init__.py | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/rteval/modules/loads/__init__.py b/rteval/modules/loads/__init__.py
|
||||
index 761cc8c..74aad58 100644
|
||||
--- a/rteval/modules/loads/__init__.py
|
||||
+++ b/rteval/modules/loads/__init__.py
|
||||
@@ -138,7 +138,7 @@ class LoadModules(RtEvalModules):
|
||||
# Convert str to list and remove offline cpus
|
||||
cpulist = CpuList(cpulist).cpulist
|
||||
else:
|
||||
- cpulist = SysTop().online_cpus()
|
||||
+ cpulist = SysTop().default_cpus()
|
||||
rep_n.newProp("loadcpus", collapse_cpulist(cpulist))
|
||||
|
||||
return rep_n
|
||||
diff --git a/rteval/modules/measurement/__init__.py b/rteval/modules/measurement/__init__.py
|
||||
index d99873e..0e395be 100644
|
||||
--- a/rteval/modules/measurement/__init__.py
|
||||
+++ b/rteval/modules/measurement/__init__.py
|
||||
@@ -194,7 +194,7 @@ measurement profiles, based on their characteristics"""
|
||||
# Convert str to list and remove offline cpus
|
||||
cpulist = CpuList(cpulist).cpulist
|
||||
else:
|
||||
- cpulist = SysTop().online_cpus()
|
||||
+ cpulist = SysTop().default_cpus()
|
||||
rep_n.newProp("measurecpus", collapse_cpulist(cpulist))
|
||||
|
||||
for mp in self.__measureprofiles:
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,41 +0,0 @@
|
||||
From 4ee01e7b82e348d57621a87b9862ebdfd81aefe8 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:05 +0200
|
||||
Subject: [PATCH] rteval: Exclude isolcpus from stressng by default
|
||||
|
||||
Note: this has little effect now, because the cpus variables is only
|
||||
used for removing empty nodes unless a cpulist is specified by the user.
|
||||
However, this can change in the future.
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/modules/loads/stressng.py | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py
|
||||
index 85cb473..800fdec 100644
|
||||
--- a/rteval/modules/loads/stressng.py
|
||||
+++ b/rteval/modules/loads/stressng.py
|
||||
@@ -9,6 +9,7 @@ from rteval.Log import Log
|
||||
from rteval.systopology import CpuList, SysTopology
|
||||
|
||||
expand_cpulist = CpuList.expand_cpulist
|
||||
+nonisolated_cpulist = CpuList.nonisolated_cpulist
|
||||
|
||||
class Stressng(CommandLineLoad):
|
||||
" This class creates a load module that runs stress-ng "
|
||||
@@ -69,6 +70,10 @@ class Stressng(CommandLineLoad):
|
||||
# if a cpulist was specified, only allow cpus in that list on the node
|
||||
if self.cpulist:
|
||||
cpus[n] = [c for c in cpus[n] if c in expand_cpulist(self.cpulist)]
|
||||
+ # if a cpulist was not specified, exclude isolated cpus
|
||||
+ else:
|
||||
+ cpus[n] = CpuList.nonisolated_cpulist(cpus[n])
|
||||
+
|
||||
|
||||
# remove nodes with no cpus available for running
|
||||
for node, cpu in cpus.items():
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 9c096f32cb35452b3475198fcab8ad4356151e86 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:06 +0200
|
||||
Subject: [PATCH] rteval: Fix CPU count calculation for hackbench
|
||||
|
||||
Use count from cpulist when specified and all CPUs on node excluding
|
||||
offline ones and isolated ones if not specified.
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
---
|
||||
rteval/modules/loads/hackbench.py | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rteval/modules/loads/hackbench.py b/rteval/modules/loads/hackbench.py
|
||||
index 14e60d1..f5a547e 100644
|
||||
--- a/rteval/modules/loads/hackbench.py
|
||||
+++ b/rteval/modules/loads/hackbench.py
|
||||
@@ -38,6 +38,7 @@ from rteval.Log import Log
|
||||
from rteval.systopology import CpuList, SysTopology
|
||||
|
||||
expand_cpulist = CpuList.expand_cpulist
|
||||
+isolated_cpulist = CpuList.isolated_cpulist
|
||||
|
||||
class Hackbench(CommandLineLoad):
|
||||
def __init__(self, config, logger):
|
||||
@@ -77,9 +78,12 @@ class Hackbench(CommandLineLoad):
|
||||
# if a cpulist was specified, only allow cpus in that list on the node
|
||||
if self.cpulist:
|
||||
self.cpus[n] = [c for c in self.cpus[n] if c in expand_cpulist(self.cpulist)]
|
||||
+ # if a cpulist was not specified, exclude isolated cpus
|
||||
+ else:
|
||||
+ self.cpus[n] = CpuList.nonisolated_cpulist(self.cpus[n])
|
||||
|
||||
# track largest number of cpus used on a node
|
||||
- node_biggest = len(sysTop.getcpus(int(n)))
|
||||
+ node_biggest = len(self.cpus[n])
|
||||
if node_biggest > biggest:
|
||||
biggest = node_biggest
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 78bd089e89e15b09db8e1d2bdcc0d9620d4da03c Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Tue, 6 Dec 2022 14:44:44 -0500
|
||||
Subject: rteval: Log.py: Convert to f-strings
|
||||
|
||||
Convert Log.py to f-strings
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/Log.py | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/rteval/Log.py b/rteval/Log.py
|
||||
index 63ca3b8681f8..8d08ab3e210a 100644
|
||||
--- a/rteval/Log.py
|
||||
+++ b/rteval/Log.py
|
||||
@@ -60,10 +60,7 @@ class Log:
|
||||
|
||||
def log(self, logtype, msg):
|
||||
if (logtype & self.__logverb) or logtype == self.ALWAYS:
|
||||
- self.__logfile.write("%s%s\n" %
|
||||
- (self.__logtype_str(logtype),
|
||||
- msg)
|
||||
- )
|
||||
+ self.__logfile.write(f"{self.__logtype_str(logtype)}{msg}\n")
|
||||
|
||||
|
||||
|
||||
@@ -80,8 +77,8 @@ def unit_test(rootdir):
|
||||
def run_log_test(l):
|
||||
for lt in range(min(logtypes), max(logtypes)*2):
|
||||
test = ", ".join([logtypes_s[logtypes.index(i)] for i in [p for p in takewhile(lambda x: x <= lt, (2**i for i in count())) if p & lt]])
|
||||
- print("Testing verbosity flags set to: (%i) %s" % (lt, test))
|
||||
- msg = "Log entry when verbosity is set to %i [%s]" % (lt, test)
|
||||
+ print(f"Testing verbosity flags set to: ({lt}) {test}")
|
||||
+ msg = f"Log entry when verbosity is set to {lt} [{test}]"
|
||||
l.SetLogVerbosity(lt)
|
||||
test_log(l, msg)
|
||||
print("-"*20)
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,399 +0,0 @@
|
||||
From d0552193364d160252d117c5bf2e298a31550e3c Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Mon, 10 Oct 2022 09:49:47 -0400
|
||||
Subject: [PATCH] rteval: Replace python-ethtool with inline code
|
||||
|
||||
This patch adds the file newnet.py to replace the use of python-ethtool
|
||||
The information it generates will appear in the summary.xml
|
||||
You can also test the functionality by running
|
||||
python rteval/sysinfo/newnet.py
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
- V2 Add SPDX license identifier
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/__init__.py | 3 +-
|
||||
rteval/sysinfo/network.py | 117 -------------------
|
||||
rteval/sysinfo/newnet.py | 225 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 227 insertions(+), 118 deletions(-)
|
||||
delete mode 100644 rteval/sysinfo/network.py
|
||||
create mode 100644 rteval/sysinfo/newnet.py
|
||||
|
||||
diff --git a/rteval/sysinfo/__init__.py b/rteval/sysinfo/__init__.py
|
||||
index a4359382f006..bb1d00810856 100644
|
||||
--- a/rteval/sysinfo/__init__.py
|
||||
+++ b/rteval/sysinfo/__init__.py
|
||||
@@ -32,7 +32,7 @@ from rteval.sysinfo.services import SystemServices
|
||||
from rteval.sysinfo.cputopology import CPUtopology
|
||||
from rteval.sysinfo.memory import MemoryInfo
|
||||
from rteval.sysinfo.osinfo import OSInfo
|
||||
-from rteval.sysinfo.network import NetworkInfo
|
||||
+from rteval.sysinfo.newnet import NetworkInfo
|
||||
from rteval.sysinfo.cmdline import cmdlineInfo
|
||||
from rteval.sysinfo import dmi
|
||||
|
||||
@@ -46,6 +46,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology,
|
||||
CPUtopology.__init__(self)
|
||||
OSInfo.__init__(self, logger=logger)
|
||||
cmdlineInfo.__init__(self, logger=logger)
|
||||
+ NetworkInfo.__init__(self, logger=logger)
|
||||
|
||||
# Parse initial DMI decoding errors
|
||||
dmi.ProcessWarnings()
|
||||
diff --git a/rteval/sysinfo/network.py b/rteval/sysinfo/network.py
|
||||
deleted file mode 100644
|
||||
index ce9989a1240b..000000000000
|
||||
--- a/rteval/sysinfo/network.py
|
||||
+++ /dev/null
|
||||
@@ -1,117 +0,0 @@
|
||||
-# -*- coding: utf-8 -*-
|
||||
-#
|
||||
-# Copyright 2009 - 2013 David Sommerseth <davids@redhat.com>
|
||||
-#
|
||||
-# This program is free software; you can redistribute it and/or modify
|
||||
-# it under the terms of the GNU General Public License as published by
|
||||
-# the Free Software Foundation; either version 2 of the License, or
|
||||
-# (at your option) any later version.
|
||||
-#
|
||||
-# This program is distributed in the hope that it will be useful,
|
||||
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-# GNU General Public License for more details.
|
||||
-#
|
||||
-# You should have received a copy of the GNU General Public License along
|
||||
-# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
-#
|
||||
-# For the avoidance of doubt the "preferred form" of this code is one which
|
||||
-# is in an open unpatent encumbered format. Where cryptographic key signing
|
||||
-# forms part of the process of creating an executable the information
|
||||
-# including keys needed to generate an equivalently functional executable
|
||||
-# are deemed to be part of the source code.
|
||||
-#
|
||||
-
|
||||
-import ethtool, libxml2
|
||||
-
|
||||
-class NetworkInfo(object):
|
||||
- def __init__(self):
|
||||
- pass
|
||||
-
|
||||
- def net_GetDefaultGW(self):
|
||||
- # Get the interface name for the IPv4 default gw
|
||||
- route = open('/proc/net/route')
|
||||
- defgw4 = None
|
||||
- if route:
|
||||
- rl = route.readline()
|
||||
- while rl != '' :
|
||||
- rl = route.readline()
|
||||
- splt = rl.split("\t")
|
||||
- # Only catch default route
|
||||
- if len(splt) > 2 and splt[2] != '00000000' and splt[1] == '00000000':
|
||||
- defgw4 = splt[0]
|
||||
- break
|
||||
- route.close()
|
||||
- return (defgw4, None) # IPv6 gw not yet implemented
|
||||
-
|
||||
- def MakeReport(self):
|
||||
- ncfg_n = libxml2.newNode("NetworkConfig")
|
||||
- (defgw4, defgw6) = self.net_GetDefaultGW()
|
||||
-
|
||||
- # Make an interface tag for each device found
|
||||
- if hasattr(ethtool, 'get_interfaces_info'):
|
||||
- # Using the newer python-ethtool API (version >= 0.4)
|
||||
- for dev in ethtool.get_interfaces_info(ethtool.get_devices()):
|
||||
- if dev.device == 'lo':
|
||||
- continue
|
||||
-
|
||||
- intf_n = libxml2.newNode('interface')
|
||||
- intf_n.newProp('device', dev.device)
|
||||
- intf_n.newProp('hwaddr', dev.mac_address)
|
||||
- ncfg_n.addChild(intf_n)
|
||||
-
|
||||
- # Protcol configurations
|
||||
- if dev.ipv4_address:
|
||||
- ipv4_n = libxml2.newNode('IPv4')
|
||||
- ipv4_n.newProp('ipaddr', dev.ipv4_address)
|
||||
- ipv4_n.newProp('netmask', str(dev.ipv4_netmask))
|
||||
- ipv4_n.newProp('broadcast', dev.ipv4_broadcast)
|
||||
- ipv4_n.newProp('defaultgw', (defgw4 == dev.device) and '1' or '0')
|
||||
- intf_n.addChild(ipv4_n)
|
||||
-
|
||||
- for ip6 in dev.get_ipv6_addresses():
|
||||
- ipv6_n = libxml2.newNode('IPv6')
|
||||
- ipv6_n.newProp('ipaddr', ip6.address)
|
||||
- ipv6_n.newProp('netmask', str(ip6.netmask))
|
||||
- ipv6_n.newProp('scope', ip6.scope)
|
||||
- intf_n.addChild(ipv6_n)
|
||||
-
|
||||
- else: # Fall back to older python-ethtool API (version < 0.4)
|
||||
- ifdevs = ethtool.get_active_devices()
|
||||
- ifdevs.remove('lo')
|
||||
- ifdevs.sort()
|
||||
-
|
||||
- for dev in ifdevs:
|
||||
- intf_n = libxml2.newNode('interface')
|
||||
- intf_n.newProp('device', dev.device)
|
||||
- intf_n.newProp('hwaddr', dev.mac_address)
|
||||
- ncfg_n.addChild(intf_n)
|
||||
-
|
||||
- ipv4_n = libxml2.newNode('IPv4')
|
||||
- ipv4_n.newProp('ipaddr', ethtool.get_ipaddr(dev))
|
||||
- ipv4_n.newProp('netmask', str(ethtool.get_netmask(dev)))
|
||||
- ipv4_n.newProp('defaultgw', (defgw4 == dev) and '1' or '0')
|
||||
- intf_n.addChild(ipv4_n)
|
||||
-
|
||||
- return ncfg_n
|
||||
-
|
||||
-
|
||||
-def unit_test(rootdir):
|
||||
- import sys
|
||||
- try:
|
||||
- net = NetworkInfo()
|
||||
- doc = libxml2.newDoc('1.0')
|
||||
- cfg = net.MakeReport()
|
||||
- doc.setRootElement(cfg)
|
||||
- doc.saveFormatFileEnc('-', 'UTF-8', 1)
|
||||
-
|
||||
- except Exception as e:
|
||||
- import traceback
|
||||
- traceback.print_exc(file=sys.stdout)
|
||||
- print("** EXCEPTION %s", str(e))
|
||||
- return 1
|
||||
-
|
||||
-if __name__ == '__main__':
|
||||
- unit_test(None)
|
||||
-
|
||||
diff --git a/rteval/sysinfo/newnet.py b/rteval/sysinfo/newnet.py
|
||||
new file mode 100644
|
||||
index 000000000000..63417d9e59f1
|
||||
--- /dev/null
|
||||
+++ b/rteval/sysinfo/newnet.py
|
||||
@@ -0,0 +1,225 @@
|
||||
+''' Module to obtain network information for the rteval report '''
|
||||
+#
|
||||
+# Copyright 2022 John Kacur <jkacur@redhat.com
|
||||
+# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+#
|
||||
+
|
||||
+import os
|
||||
+import socket
|
||||
+import ipaddress
|
||||
+import sys
|
||||
+import libxml2
|
||||
+from rteval.Log import Log
|
||||
+
|
||||
+def get_active_devices():
|
||||
+ ''' returns a list of active network devices, similar to ethtool '''
|
||||
+ ret = []
|
||||
+
|
||||
+ for device in socket.if_nameindex():
|
||||
+ ret.append(device[1])
|
||||
+
|
||||
+ return ret
|
||||
+
|
||||
+def compress_iv6(addr):
|
||||
+ ''' inserts colons into an ipv6address and returns it in compressed form '''
|
||||
+ retaddr = ''
|
||||
+ # Insert colons into the number
|
||||
+ for i in range(4,33,4):
|
||||
+ if i == 32:
|
||||
+ retaddr += addr[i-4:i]
|
||||
+ else:
|
||||
+ retaddr += addr[i-4:i] + ':'
|
||||
+ addr = ipaddress.IPv6Network(retaddr)
|
||||
+ retaddr = str(ipaddress.IPv6Address(retaddr))
|
||||
+ return retaddr
|
||||
+
|
||||
+def get_defaultgw():
|
||||
+ ''' return the ipv4address of the default gateway '''
|
||||
+ defaultgw = None
|
||||
+ with open('/proc/net/route') as f:
|
||||
+ line = f.readline().strip()
|
||||
+ while len(line) > 0:
|
||||
+ (iface, dest, gateway, _, _, _, _, _, _, _, _) = line.split()
|
||||
+ if iface == 'Iface':
|
||||
+ line = f.readline().strip()
|
||||
+ continue
|
||||
+ if dest == '00000000' and gateway != '00000000':
|
||||
+ addr = int(gateway, base=16)
|
||||
+ defaultgw = str(ipaddress.IPv4Address(socket.ntohl(addr)))
|
||||
+ return defaultgw
|
||||
+ line = f.readline().strip()
|
||||
+ return defaultgw
|
||||
+
|
||||
+class IPv6Addresses():
|
||||
+ ''' Obtains a list of IPv6 addresses from the proc file system '''
|
||||
+
|
||||
+ def __init__(self):
|
||||
+ self.data = {}
|
||||
+ IPv6Addresses.load(self)
|
||||
+
|
||||
+ def __contains__(self, dev):
|
||||
+ return dev in self.data
|
||||
+
|
||||
+ def __getitem__(self, dev):
|
||||
+ return self.data.get(dev, None)
|
||||
+
|
||||
+ def __iter__(self):
|
||||
+ return iter(self.data)
|
||||
+
|
||||
+ def load(self):
|
||||
+ '''
|
||||
+ Called by init to load the self.data dictionary with device keys
|
||||
+ and a list of ipv6addresses
|
||||
+ '''
|
||||
+ MYP = '/proc/net/if_inet6'
|
||||
+ with open(MYP, 'r') as f:
|
||||
+ mystr = f.readline().strip()
|
||||
+ while len(mystr) > 0:
|
||||
+ ipv6addr , _, _, _, _, intf = mystr.split()
|
||||
+ ipv6addr = compress_iv6(ipv6addr)
|
||||
+ if intf == 'lo':
|
||||
+ mystr = f.readline().strip()
|
||||
+ continue
|
||||
+ if intf not in self.data:
|
||||
+ self.data[intf] = [ipv6addr]
|
||||
+ else:
|
||||
+ self.data[intf].append(ipv6addr)
|
||||
+ mystr = f.readline().strip()
|
||||
+
|
||||
+class IPv4Addresses():
|
||||
+ ''' Obtains a list of IPv4 addresses from the proc file system '''
|
||||
+
|
||||
+ def __init__(self):
|
||||
+ self.data = {}
|
||||
+ IPv4Addresses.load(self)
|
||||
+
|
||||
+ def __contains__(self, dev):
|
||||
+ return dev in self.data
|
||||
+
|
||||
+ def __getitem__(self, dev):
|
||||
+ return self.data[dev]
|
||||
+
|
||||
+ def __iter__(self):
|
||||
+ return iter(self.data)
|
||||
+
|
||||
+ def load(self):
|
||||
+ '''
|
||||
+ Called by init to load the self.data dictionary with
|
||||
+ device keys, and value consisting of a list of
|
||||
+ ipv4address, netmask and broadcast address
|
||||
+ '''
|
||||
+ MYP = '/proc/net/route'
|
||||
+ with open(MYP, 'r') as f:
|
||||
+ mystr = f.readline().strip()
|
||||
+ while len(mystr) > 0:
|
||||
+ intf, dest, _, _, _, _, _, mask, _, _, _ = mystr.split()
|
||||
+ # Skip over the head of the table an the gateway line
|
||||
+ if intf == "Iface" or dest == '00000000':
|
||||
+ mystr = f.readline().strip()
|
||||
+ continue
|
||||
+ d1 = int(dest, base=16)
|
||||
+ m1 = int(mask, base=16)
|
||||
+ addr = str(ipaddress.IPv4Address(socket.ntohl(d1)))
|
||||
+ netmask = str(ipaddress.IPv4Address(socket.ntohl(m1)))
|
||||
+ addr_with_mask = ipaddress.ip_network(addr + '/' + netmask)
|
||||
+ broadcast = str(addr_with_mask.broadcast_address)
|
||||
+ if intf not in self.data:
|
||||
+ self.data[intf] = [(addr, netmask, broadcast)]
|
||||
+ else:
|
||||
+ self.data[intf].append((addr, netmask, broadcast))
|
||||
+ mystr = f.readline().strip()
|
||||
+
|
||||
+
|
||||
+class MacAddresses():
|
||||
+ ''' Obtains a list of hardware addresses of network devices '''
|
||||
+
|
||||
+ def __init__(self):
|
||||
+ self.mac_address = {}
|
||||
+ self.path = None
|
||||
+ MacAddresses.load(self)
|
||||
+
|
||||
+ def load(self):
|
||||
+ '''
|
||||
+ called by init to load self.mac_address as a dictionary of
|
||||
+ device keys, and mac or hardware addresses as values
|
||||
+ '''
|
||||
+ nics = get_active_devices()
|
||||
+ for nic in nics:
|
||||
+ self.path = f'/sys/class/net/{nic}'
|
||||
+ hwaddr = MacAddresses.set_val(self, 'address')
|
||||
+ self.mac_address[nic] = hwaddr
|
||||
+
|
||||
+ def set_val(self, val):
|
||||
+ ''' Return the result of reading self.path/val '''
|
||||
+ val_path = f'{self.path}/{val}'
|
||||
+ if os.path.exists(val_path):
|
||||
+ with open(val_path, 'r') as f:
|
||||
+ return f.readline().strip()
|
||||
+ return None
|
||||
+
|
||||
+ def __contains__(self, dev):
|
||||
+ return dev in self.mac_address
|
||||
+
|
||||
+ def __getitem__(self, dev):
|
||||
+ return self.mac_address[dev]
|
||||
+
|
||||
+ def __iter__(self):
|
||||
+ return iter(self.mac_address)
|
||||
+
|
||||
+class NetworkInfo():
|
||||
+ ''' Creates an xml report of the network for rteval '''
|
||||
+
|
||||
+ def __init__(self, logger):
|
||||
+ self.defgw4 = get_defaultgw()
|
||||
+ self.__logger = logger
|
||||
+
|
||||
+ def MakeReport(self):
|
||||
+ ''' Make an xml report for rteval '''
|
||||
+ ncfg_n = libxml2.newNode("NetworkConfig")
|
||||
+ defgw4 = self.defgw4
|
||||
+
|
||||
+ mads = MacAddresses()
|
||||
+ for device in mads:
|
||||
+ if device == 'lo':
|
||||
+ continue
|
||||
+ intf_n = libxml2.newNode('interface')
|
||||
+ intf_n.newProp('device', device)
|
||||
+ intf_n.newProp('hwaddr', mads[device])
|
||||
+ ncfg_n.addChild(intf_n)
|
||||
+
|
||||
+ ipv4ads = IPv4Addresses()
|
||||
+ ipv6ads = IPv6Addresses()
|
||||
+ for dev in ipv4ads:
|
||||
+ if dev != device:
|
||||
+ continue
|
||||
+ for lelem in ipv4ads[dev]:
|
||||
+ ipv4_n = libxml2.newNode('IPv4')
|
||||
+ (ipaddr, netmask, broadcast) = lelem
|
||||
+ ipv4_n.newProp('ipaddr', ipaddr)
|
||||
+ ipv4_n.newProp('netmask', netmask)
|
||||
+ ipv4_n.newProp('broadcast', broadcast)
|
||||
+ ipv4_n.newProp('defaultgw', (defgw4 == ipaddr) and '1' or '0')
|
||||
+ intf_n.addChild(ipv4_n)
|
||||
+ if ipv6ads[dev]:
|
||||
+ for lelem in ipv6ads[dev]:
|
||||
+ ipv6_n = libxml2.newNode('IPv6')
|
||||
+ ipaddr = lelem
|
||||
+ ipv6_n.newProp('ipaddr', ipaddr)
|
||||
+ intf_n.addChild(ipv6_n)
|
||||
+ return ncfg_n
|
||||
+
|
||||
+if __name__ == "__main__":
|
||||
+
|
||||
+ try:
|
||||
+ log = Log()
|
||||
+ log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||
+ net = NetworkInfo(logger=log)
|
||||
+ doc = libxml2.newDoc('1.0')
|
||||
+ cfg = net.MakeReport()
|
||||
+ doc.setRootElement(cfg)
|
||||
+ doc.saveFormatFileEnc('-', 'UTF-8', 1)
|
||||
+
|
||||
+ except Exception as e:
|
||||
+ import traceback
|
||||
+ traceback.print_exc(file=sys.stdout)
|
||||
+ print(f"** EXCEPTION {str(e)}")
|
||||
--
|
||||
2.37.3
|
||||
|
@ -1,83 +0,0 @@
|
||||
From cb7ba0c0db7631021341b7fa692c286fd9d33cd1 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Glozar <tglozar@redhat.com>
|
||||
Date: Fri, 30 Jun 2023 11:19:03 +0200
|
||||
Subject: [PATCH] rteval: Report isolated CPUs
|
||||
|
||||
Add a flag for whether a CPU is isolated in CPUtopology and display
|
||||
the number of isolated CPUs in text report.
|
||||
|
||||
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rteval_text.xsl | 4 ++++
|
||||
rteval/sysinfo/cputopology.py | 11 +++++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/rteval/rteval_text.xsl b/rteval/rteval_text.xsl
|
||||
index 7ecfac6..0ef649b 100644
|
||||
--- a/rteval/rteval_text.xsl
|
||||
+++ b/rteval/rteval_text.xsl
|
||||
@@ -59,6 +59,10 @@
|
||||
<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores"/>
|
||||
<xsl:text> (online: </xsl:text>
|
||||
<xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_online"/>
|
||||
+ <xsl:if test="SystemInfo/CPUtopology/@num_cpu_cores_isolated != 0">
|
||||
+ <xsl:text>, isolated: </xsl:text>
|
||||
+ <xsl:value-of select="SystemInfo/CPUtopology/@num_cpu_cores_isolated"/>
|
||||
+ </xsl:if>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="hardware/cpu_topology">
|
||||
diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py
|
||||
index 2bb6323..f60b059 100644
|
||||
--- a/rteval/sysinfo/cputopology.py
|
||||
+++ b/rteval/sysinfo/cputopology.py
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
import os
|
||||
import libxml2
|
||||
+from rteval.systopology import SysTopology
|
||||
|
||||
class CPUtopology:
|
||||
"Retrieves an overview over the installed CPU cores and the system topology"
|
||||
@@ -34,6 +35,7 @@ class CPUtopology:
|
||||
self.__cputop_n = None
|
||||
self.__cpu_cores = 0
|
||||
self.__online_cores = 0
|
||||
+ self.__isolated_cores = 0
|
||||
self.__cpu_sockets = 0
|
||||
|
||||
def __read(self, dirname, fname):
|
||||
@@ -51,6 +53,10 @@ class CPUtopology:
|
||||
|
||||
self.__cputop_n = libxml2.newNode('CPUtopology')
|
||||
|
||||
+ # Get list of isolated CPUs from SysTopology
|
||||
+ systopology = SysTopology()
|
||||
+ isolated_cpus = {'cpu' + n for n in systopology.isolated_cpus_str()}
|
||||
+
|
||||
cpusockets = []
|
||||
for dirname in os.listdir(self.sysdir):
|
||||
# Only parse directories which starts with 'cpu'
|
||||
@@ -82,6 +88,10 @@ class CPUtopology:
|
||||
'physical_package_id')
|
||||
cpu_n.newProp('physical_package_id', str(phys_pkg_id))
|
||||
cpusockets.append(phys_pkg_id)
|
||||
+ is_isolated = dirname in isolated_cpus
|
||||
+ if is_isolated:
|
||||
+ self.__isolated_cores += 1
|
||||
+ cpu_n.newProp('isolated', str(int(dirname in isolated_cpus)))
|
||||
break
|
||||
|
||||
# Count unique CPU sockets
|
||||
@@ -97,6 +107,7 @@ class CPUtopology:
|
||||
# Summarise the core counts
|
||||
self.__cputop_n.newProp('num_cpu_cores', str(self.__cpu_cores))
|
||||
self.__cputop_n.newProp('num_cpu_cores_online', str(self.__online_cores))
|
||||
+ self.__cputop_n.newProp('num_cpu_cores_isolated', str(self.__isolated_cores))
|
||||
self.__cputop_n.newProp('num_cpu_sockets', str(self.__cpu_sockets))
|
||||
|
||||
return self.__cputop_n
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,31 +0,0 @@
|
||||
From c8f7457cfb23b595bdd3f500dc1c9790c7302dd3 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:29 -0400
|
||||
Subject: rteval: Use f-strings in cputopology
|
||||
|
||||
Use f-strings in cputopology
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/cputopology.py | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/cputopology.py b/rteval/sysinfo/cputopology.py
|
||||
index ced7e1f295b7..2bb632312320 100644
|
||||
--- a/rteval/sysinfo/cputopology.py
|
||||
+++ b/rteval/sysinfo/cputopology.py
|
||||
@@ -124,9 +124,7 @@ def unit_test(rootdir):
|
||||
x.saveFormatFileEnc('-', 'UTF-8', 1)
|
||||
|
||||
print(" ---- getCPUcores() / getCPUscokets() ---- ")
|
||||
- print("CPU cores: %i (online: %i) - CPU sockets: %i" % (cputop.cpu_getCores(False),
|
||||
- cputop.cpu_getCores(True),
|
||||
- cputop.cpu_getSockets()))
|
||||
+ print(f"CPU cores: {cputop.cpu_getCores(False)} (online: {cputop.cpu_getCores(True)}) - CPU sockets: {cputop.cpu_getSockets()}")
|
||||
return 0
|
||||
except Exception as e:
|
||||
# import traceback
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,31 +0,0 @@
|
||||
From a4acd156917024303f326dd5e66a7c9e2d12fda3 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:30 -0400
|
||||
Subject: rteval: Use f-strings in kernel.py
|
||||
|
||||
Use f-strings in kernel.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/kernel.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/kernel.py b/rteval/sysinfo/kernel.py
|
||||
index f2e9d72ac2ef..ba5cadda40c5 100644
|
||||
--- a/rteval/sysinfo/kernel.py
|
||||
+++ b/rteval/sysinfo/kernel.py
|
||||
@@ -47,8 +47,8 @@ class KernelInfo:
|
||||
policies = {'DLN': 'deadline', 'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown'}
|
||||
ret_kthreads = {}
|
||||
self.__log(Log.DEBUG, "getting kthread status")
|
||||
- cmd = '%s -eocommand,pid,policy,rtprio,comm' % getcmdpath('ps')
|
||||
- self.__log(Log.DEBUG, "cmd: %s" % cmd)
|
||||
+ cmd = f"{getcmdpath('ps')} -eocommand,pid,policy,rtprio,comm"
|
||||
+ self.__log(Log.DEBUG, f"cmd: {cmd}")
|
||||
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
||||
for p in c.stdout:
|
||||
v = p.strip().split()
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 6e063353072b73e43a732bb5dfa265767ac0dbd7 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:31 -0400
|
||||
Subject: rteval: Use f-strings in memory.py
|
||||
|
||||
Use f-strings in memory.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/memory.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/memory.py b/rteval/sysinfo/memory.py
|
||||
index 7c5fd6f315cf..cc2fa2cfa4be 100644
|
||||
--- a/rteval/sysinfo/memory.py
|
||||
+++ b/rteval/sysinfo/memory.py
|
||||
@@ -49,7 +49,7 @@ class MemoryInfo:
|
||||
if l.startswith('MemTotal:'):
|
||||
parts = l.split()
|
||||
if parts[2].lower() != 'kb':
|
||||
- raise RuntimeError("Units changed from kB! (%s)" % parts[2])
|
||||
+ raise RuntimeError(f"Units changed from kB! ({parts[2]})")
|
||||
rawsize = int(parts[1])
|
||||
f.close()
|
||||
break
|
||||
@@ -76,7 +76,7 @@ class MemoryInfo:
|
||||
|
||||
memsize = self.mem_get_size()
|
||||
mem_n = libxml2.newNode("memory_size")
|
||||
- mem_n.addContent("%.3f" % memsize[0])
|
||||
+ mem_n.addContent(f"{memsize[0]:.3f}")
|
||||
mem_n.newProp("unit", memsize[1])
|
||||
rep_n.addChild(mem_n)
|
||||
|
||||
@@ -88,8 +88,8 @@ def unit_test(rootdir):
|
||||
import sys
|
||||
try:
|
||||
mi = MemoryInfo()
|
||||
- print("Numa nodes: %i" % mi.mem_get_numa_nodes())
|
||||
- print("Memory: %i %s" % mi.mem_get_size())
|
||||
+ print(f"Numa nodes: {mi.mem_get_numa_nodes()}")
|
||||
+ print(f"Memory: {int(mi.mem_get_size()[0])} {mi.mem_get_size()[1]}")
|
||||
except Exception as e:
|
||||
import traceback
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,61 +0,0 @@
|
||||
From f821e5f2daf595838395d80ba89ee5699076daf1 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:32 -0400
|
||||
Subject: rteval: Use f-strings in osinfo
|
||||
|
||||
Use f-strings in osinfo.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/osinfo.py | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py
|
||||
index ead5e3939cfa..83dc78b96fdd 100644
|
||||
--- a/rteval/sysinfo/osinfo.py
|
||||
+++ b/rteval/sysinfo/osinfo.py
|
||||
@@ -55,9 +55,9 @@ class OSInfo:
|
||||
shutil.copyfile(dpath, os.path.join(repdir, "dmesg"))
|
||||
return
|
||||
if os.path.exists('/usr/bin/dmesg'):
|
||||
- subprocess.call('/usr/bin/dmesg > %s' % os.path.join(repdir, "dmesg"), shell=True)
|
||||
+ subprocess.call(f'/usr/bin/dmesg > {os.path.join(repdir, "dmesg")}', shell=True)
|
||||
return
|
||||
- print("dmesg file not found at %s and no dmesg exe found!" % dpath)
|
||||
+ print(f"dmesg file not found at {dpath} and no dmesg exe found!")
|
||||
|
||||
|
||||
|
||||
@@ -69,16 +69,16 @@ class OSInfo:
|
||||
else:
|
||||
raise RuntimeError("Can't find sosreport/sysreport")
|
||||
|
||||
- self.__logger.log(Log.DEBUG, "report tool: %s" % exe)
|
||||
+ self.__logger.log(Log.DEBUG, f"report tool: {exe}")
|
||||
options = ['-k', 'rpm.rpmva=off',
|
||||
'--name=rteval',
|
||||
'--batch']
|
||||
|
||||
self.__logger.log(Log.INFO, "Generating SOS report")
|
||||
- self.__logger.log(Log.INFO, "using command %s" % " ".join([exe]+options))
|
||||
+ self.__logger.log(Log.INFO, f"using command {' '.join([exe]+options)}")
|
||||
subprocess.call([exe] + options)
|
||||
for s in glob('/tmp/s?sreport-rteval-*'):
|
||||
- self.__logger.log(Log.DEBUG, "moving %s to %s" % (s, repdir))
|
||||
+ self.__logger.log(Log.DEBUG, f"moving {s} to {repdir}")
|
||||
shutil.move(s, repdir)
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ def unit_test(rootdir):
|
||||
log = Log()
|
||||
log.SetLogVerbosity(Log.DEBUG|Log.INFO)
|
||||
osi = OSInfo(logger=log)
|
||||
- print("Base OS: %s" % osi.get_base_os())
|
||||
+ print(f"Base OS: {osi.get_base_os()}")
|
||||
|
||||
print("Testing OSInfo::copy_dmesg('/tmp'): ", end=' ')
|
||||
osi.copy_dmesg('/tmp')
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 2de834b44c2a731bc25449d84456396c0d519198 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:28 -0400
|
||||
Subject: rteval: Use f-strings in rtevalConfig
|
||||
|
||||
Use f-strings in rtevalConfig.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rtevalConfig.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
|
||||
index de88924642ca..41f1a567720f 100644
|
||||
--- a/rteval/rtevalConfig.py
|
||||
+++ b/rteval/rtevalConfig.py
|
||||
@@ -115,7 +115,7 @@ class rtevalCfgSection:
|
||||
"Simple method for dumping config when object is used as a string"
|
||||
if not self.__cfgdata:
|
||||
return "# empty"
|
||||
- return "\n".join(["%s: %s" % (k, v) for k, v in list(self.__cfgdata.items())]) + "\n"
|
||||
+ return "\n".join([f"{k}: {v}" for k, v in list(self.__cfgdata.items())]) + "\n"
|
||||
|
||||
|
||||
def __setattr__(self, key, val):
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From 5e4fed8a745f70f9be1199f047069e144e9b8fd5 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:27 -0400
|
||||
Subject: rteval: Use f-strings in rtevalclient.py
|
||||
|
||||
Use f-strings in rtevalclient.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rtevalclient.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rteval/rtevalclient.py b/rteval/rtevalclient.py
|
||||
index 26c953005326..7ff7d2700cfc 100644
|
||||
--- a/rteval/rtevalclient.py
|
||||
+++ b/rteval/rtevalclient.py
|
||||
@@ -61,7 +61,7 @@ class rtevalclient:
|
||||
cmpr = compr.compress(fbuf.getvalue())
|
||||
data = base64.b64encode(cmpr + compr.flush())
|
||||
ret = self.srv.SendReport(self.hostname, data)
|
||||
- print("rtevalclient::SendReport() - Sent %i bytes (XML document length: %i bytes, compression ratio: %.02f%%)" % (len(data), doclen, (1-(float(len(data)) / float(doclen)))*100 ))
|
||||
+ print(f"rtevalclient::SendReport() - Sent {len(data)} bytes (XML document length: {doclen} bytes, compression ratio: {(1-(float(len(data)) / float(doclen)))*100}:.2f)")
|
||||
return ret
|
||||
|
||||
def SendDataAsFile(self, fname, data, decompr = False):
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,61 +0,0 @@
|
||||
From d83a8eb7f0b830408659483922eca25b51bd7b5e Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:33 -0400
|
||||
Subject: rteval: Use f-strings in services.py
|
||||
|
||||
Use f-strings in services.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/services.py | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/services.py b/rteval/sysinfo/services.py
|
||||
index c85980e19165..a87b4abeea76 100644
|
||||
--- a/rteval/sysinfo/services.py
|
||||
+++ b/rteval/sysinfo/services.py
|
||||
@@ -55,17 +55,17 @@ class SystemServices:
|
||||
break
|
||||
if not servicesdir:
|
||||
raise RuntimeError("No services dir (init.d) found on your system")
|
||||
- self.__log(Log.DEBUG, "Services located in %s, going through each service file to check status" % servicesdir)
|
||||
+ self.__log(Log.DEBUG, f"Services located in {servicesdir}, going through each service file to check status")
|
||||
ret_services = {}
|
||||
for service in glob.glob(os.path.join(servicesdir, '*')):
|
||||
servicename = os.path.basename(service)
|
||||
if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \
|
||||
and os.access(service, os.X_OK):
|
||||
- cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service)
|
||||
+ cmd = f'{getcmdpath("grep")} -qs "\(^\|\W\)status)" {service}'
|
||||
c = subprocess.Popen(cmd, shell=True, encoding='utf-8')
|
||||
c.wait()
|
||||
if c.returncode == 0:
|
||||
- cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status']
|
||||
+ cmd = ['env', '-i', f'LANG="{os.environ["LANG"]}"', f'PATH="{os.environ["PATH"]}"', f'TERM="{os.environ["TERM"]}"', service, 'status']
|
||||
c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
|
||||
c.wait()
|
||||
if c.returncode == 0 and (c.stdout.read() or c.stderr.read()):
|
||||
@@ -79,8 +79,8 @@ class SystemServices:
|
||||
|
||||
def __get_services_systemd(self):
|
||||
ret_services = {}
|
||||
- cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl')
|
||||
- self.__log(Log.DEBUG, "cmd: %s" % cmd)
|
||||
+ cmd = f'{getcmdpath("systemctl")} list-unit-files -t service --no-legend'
|
||||
+ self.__log(Log.DEBUG, f"cmd: {cmd}")
|
||||
c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
|
||||
for p in c.stdout:
|
||||
# p are lines like b'servicename.service status'
|
||||
@@ -133,7 +133,7 @@ def unit_test(rootdir):
|
||||
|
||||
return 0
|
||||
except Exception as err:
|
||||
- print("** EXCEPTION: %s" % str(err))
|
||||
+ print(f"** EXCEPTION: {str(err)}")
|
||||
return 1
|
||||
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From adc41fa998fc15dff2c5edf3f57e6cd0970e17e5 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 16:27:34 -0400
|
||||
Subject: rteval: Use f-strings in tools.py
|
||||
|
||||
Use f-strings in tools.py
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/sysinfo/tools.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/rteval/sysinfo/tools.py b/rteval/sysinfo/tools.py
|
||||
index 3993da413d8a..aa00b3d3eafc 100644
|
||||
--- a/rteval/sysinfo/tools.py
|
||||
+++ b/rteval/sysinfo/tools.py
|
||||
@@ -40,5 +40,5 @@ def getcmdpath(which):
|
||||
pathSave[which] = cmdfile
|
||||
break
|
||||
if not pathSave[which]:
|
||||
- raise RuntimeError("Command '%s' is unknown on this system" % which)
|
||||
+ raise RuntimeError(f"Command '{which}' is unknown on this system")
|
||||
return pathSave[which]
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,119 +0,0 @@
|
||||
From 0f44bad0f6d95448425903c4ec3a3fa8093ae6e7 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 12:28:38 -0500
|
||||
Subject: rteval: rteval/__init__.py: Convert regular strings to f-strings
|
||||
|
||||
Convert regular strings to f-strings in __init__.py
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/__init__.py | 32 +++++++++++++++-----------------
|
||||
1 file changed, 15 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/rteval/__init__.py b/rteval/__init__.py
|
||||
index 22af8e85d5aa..d8127425febe 100644
|
||||
--- a/rteval/__init__.py
|
||||
+++ b/rteval/__init__.py
|
||||
@@ -59,7 +59,7 @@ def sig_handler(signum, frame):
|
||||
stopsig_received = True
|
||||
print("*** stop signal received - stopping rteval run ***")
|
||||
else:
|
||||
- raise RuntimeError("SIGNAL received! (%d)" % signum)
|
||||
+ raise RuntimeError(f"SIGNAL received! ({signum})")
|
||||
|
||||
class RtEval(rtevalReport):
|
||||
def __init__(self, config, loadmods, measuremods, logger):
|
||||
@@ -96,10 +96,10 @@ class RtEval(rtevalReport):
|
||||
self.__mailer = None
|
||||
|
||||
if not os.path.exists(self.__rtevcfg.xslt_report):
|
||||
- raise RuntimeError("can't find XSL template (%s)!" % self.__rtevcfg.xslt_report)
|
||||
+ raise RuntimeError(f"can't find XSL template ({self.__rtevcfg.xslt_report})!")
|
||||
|
||||
# Add rteval directory into module search path
|
||||
- sys.path.insert(0, '%s/rteval' % sysconfig.get_python_lib())
|
||||
+ sys.path.insert(0, f'{sysconfig.get_python_lib()}/rteval')
|
||||
|
||||
# Initialise the report module
|
||||
rtevalReport.__init__(self, self.__version,
|
||||
@@ -110,8 +110,7 @@ class RtEval(rtevalReport):
|
||||
self.__xmlrpc = rtevalXMLRPC(self.__rtevcfg.xmlrpc, self.__logger, self.__mailer)
|
||||
if not self.__xmlrpc.Ping():
|
||||
if not self.__rtevcfg.xmlrpc_noabort:
|
||||
- print("ERROR: Could not reach XML-RPC server '%s'. Aborting." % \
|
||||
- self.__rtevcfg.xmlrpc)
|
||||
+ print(f"ERROR: Could not reach XML-RPC server '{self.__rtevcfg.xmlrpc}'. Aborting.")
|
||||
sys.exit(2)
|
||||
else:
|
||||
print("WARNING: Could not ping the XML-RPC server. Will continue anyway.")
|
||||
@@ -174,8 +173,7 @@ class RtEval(rtevalReport):
|
||||
|
||||
measure_start = None
|
||||
(with_loads, run_parallel) = measure_profile.GetProfile()
|
||||
- self.__logger.log(Log.INFO, "Using measurement profile [loads: %s parallel: %s]" % (
|
||||
- with_loads, run_parallel))
|
||||
+ self.__logger.log(Log.INFO, f"Using measurement profile [loads: {with_loads} parallel: {run_parallel}]")
|
||||
try:
|
||||
nthreads = 0
|
||||
|
||||
@@ -183,23 +181,23 @@ class RtEval(rtevalReport):
|
||||
if with_loads:
|
||||
self._loadmods.Start()
|
||||
|
||||
- print("rteval run on %s started at %s" % (os.uname()[2], time.asctime()))
|
||||
+ print(f"rteval run on {os.uname()[2]} started at {time.asctime()}")
|
||||
onlinecpus = self._sysinfo.cpu_getCores(True)
|
||||
cpulist = self._loadmods._cfg.GetSection("loads").cpulist
|
||||
if cpulist:
|
||||
- print("started %d loads on cores %s" % (self._loadmods.ModulesLoaded(), cpulist), end=' ')
|
||||
+ print(f"started {self._loadmods.ModulesLoaded()} loads on cores {cpulist}", end=' ')
|
||||
else:
|
||||
- print("started %d loads on %d cores" % (self._loadmods.ModulesLoaded(), onlinecpus), end=' ')
|
||||
+ print(f"started {self._loadmods.ModulesLoaded()} loads on {onlinecpus} cores", end=' ')
|
||||
if self._sysinfo.mem_get_numa_nodes() > 1:
|
||||
- print(" with %d numa nodes" % self._sysinfo.mem_get_numa_nodes())
|
||||
+ print(f" with {self._sysinfo.mem_get_numa_nodes()} numa nodes")
|
||||
else:
|
||||
print("")
|
||||
cpulist = self._measuremods._MeasurementModules__cfg.GetSection("measurement").cpulist
|
||||
if cpulist:
|
||||
- print("started measurement threads on cores %s" % cpulist)
|
||||
+ print(f"started measurement threads on cores {cpulist}")
|
||||
else:
|
||||
- print("started measurement threads on %d cores" % onlinecpus)
|
||||
- print("Run duration: %s seconds" % str(self.__rtevcfg.duration))
|
||||
+ print(f"started measurement threads on {onlinecpus} cores")
|
||||
+ print(f"Run duration: {str(self.__rtevcfg.duration)} seconds")
|
||||
|
||||
# start the cyclictest thread
|
||||
measure_profile.Start()
|
||||
@@ -219,7 +217,7 @@ class RtEval(rtevalReport):
|
||||
# wait for time to expire or thread to die
|
||||
signal.signal(signal.SIGINT, sig_handler)
|
||||
signal.signal(signal.SIGTERM, sig_handler)
|
||||
- self.__logger.log(Log.INFO, "waiting for duration (%s)" % str(self.__rtevcfg.duration))
|
||||
+ self.__logger.log(Log.INFO, f"waiting for duration ({str(self.__rtevcfg.duration)})")
|
||||
stoptime = (time.time() + float(self.__rtevcfg.duration))
|
||||
currtime = time.time()
|
||||
rpttime = currtime + report_interval
|
||||
@@ -246,7 +244,7 @@ class RtEval(rtevalReport):
|
||||
left_to_run = stoptime - currtime
|
||||
self.__show_remaining_time(left_to_run)
|
||||
rpttime = currtime + report_interval
|
||||
- print("load average: %.2f" % self._loadmods.GetLoadAvg())
|
||||
+ print(f"load average: {self._loadmods.GetLoadAvg():.2f}")
|
||||
currtime = time.time()
|
||||
|
||||
self.__logger.log(Log.DEBUG, "out of measurement loop")
|
||||
@@ -265,7 +263,7 @@ class RtEval(rtevalReport):
|
||||
if with_loads:
|
||||
self._loadmods.Stop()
|
||||
|
||||
- print("stopping run at %s" % time.asctime())
|
||||
+ print(f"stopping run at {time.asctime()}")
|
||||
|
||||
# wait for measurement modules to finish calculating stats
|
||||
measure_profile.WaitForCompletion()
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,64 +0,0 @@
|
||||
From 0945147e2c459dfff400fe8bfdebd11e6464eab4 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 14:14:50 -0500
|
||||
Subject: rteval: rtevalConfig.py: Convert regular strings to f-strings
|
||||
|
||||
Convert regular strings to f-strings in rtevalConfig.py
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rtevalConfig.py | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
|
||||
index decd36ed18ab..de88924642ca 100644
|
||||
--- a/rteval/rtevalConfig.py
|
||||
+++ b/rteval/rtevalConfig.py
|
||||
@@ -196,7 +196,7 @@ class rtevalConfig:
|
||||
|
||||
# get our system topology info
|
||||
self.__systopology = SysTopology()
|
||||
- print(("got system topology: %s" % self.__systopology))
|
||||
+ print(f"got system topology: {self.__systopology}")
|
||||
|
||||
# Import the default config first
|
||||
for sect, vals in list(default_config.items()):
|
||||
@@ -225,7 +225,7 @@ class rtevalConfig:
|
||||
"Simple method for dumping config when object is used as a string"
|
||||
ret = ""
|
||||
for sect in list(self.__config_data.keys()):
|
||||
- ret += "[%s]\n%s\n" % (sect, str(self.__config_data[sect]))
|
||||
+ ret += f"[{sect}]\n{str(self.__config_data[sect])}\n"
|
||||
return ret
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ class rtevalConfig:
|
||||
for f in ('rteval.conf', '/etc/rteval.conf'):
|
||||
p = os.path.abspath(f)
|
||||
if os.path.exists(p):
|
||||
- self.__info("found config file %s" % p)
|
||||
+ self.__info(f"found config file {p}")
|
||||
return p
|
||||
raise RuntimeError("Unable to find configfile")
|
||||
|
||||
@@ -258,7 +258,7 @@ class rtevalConfig:
|
||||
# Don't try to reread this file if it's already been parsed
|
||||
return
|
||||
|
||||
- self.__info("reading config file %s" % cfgfile)
|
||||
+ self.__info(f"reading config file {cfgfile}")
|
||||
ini = configparser.ConfigParser()
|
||||
ini.optionxform = str
|
||||
ini.read(cfgfile)
|
||||
@@ -321,7 +321,7 @@ class rtevalConfig:
|
||||
# Return a new object with config settings of a given section
|
||||
return self.__config_data[section]
|
||||
except KeyError:
|
||||
- raise KeyError("The section '%s' does not exist in the config file" % section)
|
||||
+ raise KeyError(f"The section '{section}' does not exist in the config file")
|
||||
|
||||
|
||||
def unit_test(rootdir):
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 96ce02046afedfac27c69c30d6ee6b9511238131 Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 12:47:09 -0500
|
||||
Subject: rteval: rtevalReport.py: Convert regular strings to f-strings
|
||||
|
||||
Convert regular strings to f-strings in rtevalReport.py
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rtevalReport.py | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/rteval/rtevalReport.py b/rteval/rtevalReport.py
|
||||
index fdfaed560cfa..af3e6c9a703b 100644
|
||||
--- a/rteval/rtevalReport.py
|
||||
+++ b/rteval/rtevalReport.py
|
||||
@@ -100,11 +100,11 @@ class rtevalReport:
|
||||
|
||||
def _show_report(self, xmlfile, xsltfile):
|
||||
'''summarize a previously generated xml file'''
|
||||
- print("Loading %s for summarizing" % xmlfile)
|
||||
+ print(f"Loading {xmlfile} for summarizing")
|
||||
|
||||
xsltfullpath = os.path.join(self.__installdir, xsltfile)
|
||||
if not os.path.exists(xsltfullpath):
|
||||
- raise RuntimeError("can't find XSL template (%s)!" % xsltfullpath)
|
||||
+ raise RuntimeError(f"can't find XSL template ({xsltfullpath})!")
|
||||
|
||||
xmlreport = xmlout.XMLOut('rteval', self.__version)
|
||||
xmlreport.LoadReport(xmlfile)
|
||||
@@ -131,7 +131,7 @@ class rtevalReport:
|
||||
|
||||
def _tar_results(self):
|
||||
if not os.path.isdir(self.__reportdir):
|
||||
- raise RuntimeError("no such directory: %s" % self.__reportdir)
|
||||
+ raise RuntimeError(f"no such directory: {self.__reportdir}")
|
||||
|
||||
dirname = os.path.dirname(self.__reportdir)
|
||||
rptdir = os.path.basename(self.__reportdir)
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,114 +0,0 @@
|
||||
From eceb9de2d2a0bcf3394ca257d42f91bdcac71caf Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Wed, 9 Nov 2022 13:42:59 -0500
|
||||
Subject: rteval: rtevalXMLRPC.py: Convert regular strings to f-strings
|
||||
|
||||
Convert regular strings to f-strings in rtevalXMLRPC.py
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/rtevalXMLRPC.py | 34 ++++++++++++++--------------------
|
||||
1 file changed, 14 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/rteval/rtevalXMLRPC.py b/rteval/rtevalXMLRPC.py
|
||||
index f24e21a8ed2f..6dce12ad78bb 100644
|
||||
--- a/rteval/rtevalXMLRPC.py
|
||||
+++ b/rteval/rtevalXMLRPC.py
|
||||
@@ -33,7 +33,7 @@ from .Log import Log
|
||||
class rtevalXMLRPC:
|
||||
def __init__(self, host, logger, mailer=None):
|
||||
self.__host = host
|
||||
- self.__url = "http://%s/rteval/API1/" % self.__host
|
||||
+ self.__url = f"http://{self.__host}/rteval/API1/"
|
||||
self.__logger = logger
|
||||
self.__mailer = mailer
|
||||
self.__client = rtevalclient.rtevalclient(self.__url)
|
||||
@@ -41,7 +41,7 @@ class rtevalXMLRPC:
|
||||
|
||||
def Ping(self):
|
||||
res = None
|
||||
- self.__logger.log(Log.DEBUG, "Checking if XML-RPC server '%s' is reachable" % self.__host)
|
||||
+ self.__logger.log(Log.DEBUG, f"Checking if XML-RPC server '{self.__host}' is reachable")
|
||||
attempt = 0
|
||||
ping_success = False
|
||||
warning_sent = False
|
||||
@@ -52,10 +52,10 @@ class rtevalXMLRPC:
|
||||
ping_success = True
|
||||
except xmlrpc.client.ProtocolError:
|
||||
# Server do not support Hello(), but is reachable
|
||||
- self.__logger.log(Log.INFO, "Got XML-RPC connection with %s but it did not support Hello()" % self.__host)
|
||||
+ self.__logger.log(Log.INFO, f"Got XML-RPC connection with {self.__host} but it did not support Hello()")
|
||||
res = None
|
||||
except socket.error as err:
|
||||
- self.__logger.log(Log.INFO, "Could not establish XML-RPC contact with %s\n%s" % (self.__host, str(err)))
|
||||
+ self.__logger.log(Log.INFO, f"Could not establish XML-RPC contact with {self.__host}\n{str(err)}")
|
||||
|
||||
# Do attempts handling
|
||||
attempt += 1
|
||||
@@ -63,17 +63,16 @@ class rtevalXMLRPC:
|
||||
break # To avoid sleeping before we abort
|
||||
|
||||
if (self.__mailer is not None) and (not warning_sent):
|
||||
- self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", "Server %s did not respond." % self.__host)
|
||||
+ self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", f"Server {self.__host} did not respond.")
|
||||
warning_sent = True
|
||||
|
||||
- print("Failed pinging XML-RPC server. Doing another attempt(%i) " % attempt)
|
||||
+ print(f"Failed pinging XML-RPC server. Doing another attempt({attempt}) ")
|
||||
time.sleep(attempt) #*15) # Incremental sleep - sleep attempts*15 seconds
|
||||
ping_success = False
|
||||
|
||||
if res:
|
||||
- self.__logger.log(Log.INFO, "Verified XML-RPC connection with %s (XML-RPC API version: %i)" % (res["server"], res["APIversion"]))
|
||||
- self.__logger.log(Log.DEBUG, "Recieved greeting: %s" % res["greeting"])
|
||||
-
|
||||
+ self.__logger.log(Log.INFO, f'Verified XML-RPC connection with {res["server"]} (XML-RPC API version: {res["APIversion"]})')
|
||||
+ self.__logger.log(Log.DEBUG, f"Recieved greeting: {res['greeting']}")
|
||||
return ping_success
|
||||
|
||||
|
||||
@@ -85,9 +84,9 @@ class rtevalXMLRPC:
|
||||
warning_sent = False
|
||||
while attempt < 6:
|
||||
try:
|
||||
- print("Submitting report to %s" % self.__url)
|
||||
+ print(f"Submitting report to {self.__url}")
|
||||
rterid = self.__client.SendReport(xmlreport)
|
||||
- print("Report registered with submission id %i" % rterid)
|
||||
+ print(f"Report registered with submission id {rterid}")
|
||||
attempt = 10
|
||||
exitcode = 0 # Success
|
||||
except socket.error:
|
||||
@@ -96,12 +95,10 @@ class rtevalXMLRPC:
|
||||
break # To avoid sleeping before we abort
|
||||
|
||||
if (self.__mailer is not None) and (not warning_sent):
|
||||
- self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server",
|
||||
- "Server %s did not respond. Not giving up yet."
|
||||
- % self.__host)
|
||||
+ self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond. Not giving up yet.")
|
||||
warning_sent = True
|
||||
|
||||
- print("Failed sending report. Doing another attempt(%i) " % attempt)
|
||||
+ print(f"Failed sending report. Making another attempt({attempt}) ")
|
||||
time.sleep(attempt) #*5*60) # Incremental sleep - sleep attempts*5 minutes
|
||||
|
||||
except Exception as err:
|
||||
@@ -111,12 +108,9 @@ class rtevalXMLRPC:
|
||||
if self.__mailer is not None:
|
||||
# Send final result messages
|
||||
if exitcode == 2:
|
||||
- self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server",
|
||||
- "Server %s did not respond at all after %i attempts."
|
||||
- % (self.__host, attempt - 1))
|
||||
+ self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond at all after {attempt - 1} attempts.")
|
||||
elif (exitcode == 0) and warning_sent:
|
||||
self.__mailer.SendMessage("[RTEVAL:SUCCESS] XML-RPC server available again",
|
||||
- "Succeeded to submit the report to %s"
|
||||
- % self.__host)
|
||||
+ f"Succeeded to submit the report to {self.__host}")
|
||||
|
||||
return exitcode
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,106 +0,0 @@
|
||||
From e0c70244c34b691cf62b504f39ce5aebe2ac1d34 Mon Sep 17 00:00:00 2001
|
||||
From: Anubhav Shelat <ashelat@redhat.com>
|
||||
Date: Wed, 28 Jun 2023 13:59:03 -0400
|
||||
Subject: [PATCH] rteval/server: edited files to use optparse instead of
|
||||
argparse
|
||||
|
||||
rteval/server: edited files to use optparse instead of argparse.
|
||||
Note: Since server is disabled, these changes have not been tested.
|
||||
|
||||
Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
|
||||
- Fixed spelling in commit comments
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
server/remove_rtevalrun | 16 ++++++++--------
|
||||
server/rteval_testserver.py | 1 -
|
||||
server/testclient_sendreportfile | 10 +++++-----
|
||||
3 files changed, 13 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/server/remove_rtevalrun b/server/remove_rtevalrun
|
||||
index cee699e27c9f..7d83f71ea644 100755
|
||||
--- a/server/remove_rtevalrun
|
||||
+++ b/server/remove_rtevalrun
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
import sys
|
||||
import getpass
|
||||
-from optparse import OptionParser
|
||||
+from argparse import ArgumentParser
|
||||
from database import Database
|
||||
|
||||
def do_delete(dbc, table, rterid):
|
||||
@@ -45,20 +45,20 @@ def do_delete(dbc, table, rterid):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
- parser = OptionParser(version="%prog v0.1")
|
||||
+ parser = ArgumentParser(version="%prog v0.1")
|
||||
|
||||
- parser.add_option("-H", "--host", action="store", dest="dbhost", default="localhost",
|
||||
+ parser.add_argument("-H", "--host", action="store", dest="dbhost", default="localhost",
|
||||
help="Database server to connect to (default: %default)",
|
||||
metavar="HOST")
|
||||
- parser.add_option("-p", "--port", action="store", dest="dbport", default="5432",
|
||||
+ parser.add_argument("-p", "--port", action="store", dest="dbport", default="5432",
|
||||
help="Database server port to use (default: %default)", metavar="PORT")
|
||||
- parser.add_option("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
|
||||
+ parser.add_argument("-U", "--user", action="store", dest="dbuser", default="rtevaladmin",
|
||||
help="Database user to connect as (default: %default)", metavar="USERNAME")
|
||||
- parser.add_option("-d", "--database", action="store", dest="dbname", default="rteval",
|
||||
+ parser.add_argument("-d", "--database", action="store", dest="dbname", default="rteval",
|
||||
help="Database to use (default: %default)", metavar="DATABASE")
|
||||
- parser.add_option("-r", "--rterid", action="store", dest="rterid", default=None,
|
||||
+ parser.add_argument("-r", "--rterid", action="store", dest="rterid", default=None,
|
||||
help="rteval run id to remove from the database", metavar="INTEGER")
|
||||
- (opts, args) = parser.parse_args()
|
||||
+ opts = parser.parse_args()
|
||||
|
||||
if opts.rterid is None:
|
||||
print "%s: Missing --rterid value" % sys.argv[0]
|
||||
diff --git a/server/rteval_testserver.py b/server/rteval_testserver.py
|
||||
index 6cac85bcfe52..c7f9ce954b21 100644
|
||||
--- a/server/rteval_testserver.py
|
||||
+++ b/server/rteval_testserver.py
|
||||
@@ -30,7 +30,6 @@ import sys
|
||||
import signal
|
||||
from xmlrpc.server import SimpleXMLRPCServer
|
||||
from xmlrpc.server import SimpleXMLRPCRequestHandler
|
||||
-from optparse import OptionParser
|
||||
import argparse
|
||||
|
||||
import xmlrpc_API1
|
||||
diff --git a/server/testclient_sendreportfile b/server/testclient_sendreportfile
|
||||
index 08317b263f76..dc69a199122c 100755
|
||||
--- a/server/testclient_sendreportfile
|
||||
+++ b/server/testclient_sendreportfile
|
||||
@@ -28,22 +28,22 @@
|
||||
|
||||
import sys
|
||||
import libxml2
|
||||
-from optparse import OptionParser
|
||||
+from argparse import ArgumentParser
|
||||
|
||||
sys.path.append('../rteval')
|
||||
import rtevalclient
|
||||
|
||||
if __name__ == '__main__':
|
||||
- parser = OptionParser(version="%prog v0.1")
|
||||
+ parser = ArgumentParser(version="%prog v0.1")
|
||||
|
||||
- parser.add_option("-r", "--report", action="store", dest="report", default="summary.xml",
|
||||
+ parser.add_argument("-r", "--report", action="store", dest="report", default="summary.xml",
|
||||
help="Which XML report to send to the XML-RPC server (default: %default)",
|
||||
metavar="FILE")
|
||||
- parser.add_option("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
|
||||
+ parser.add_argument("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
|
||||
help="Hostname to the XML-RPC server to send the data (default: %default)",
|
||||
metavar="HOST[:PORT]")
|
||||
|
||||
- (opts, args) = parser.parse_args()
|
||||
+ opts = parser.parse_args()
|
||||
|
||||
d = libxml2.parseFile(opts.report)
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,64 +0,0 @@
|
||||
From ecd21eff1601e0ef666b80e0709eacbd4754250c Mon Sep 17 00:00:00 2001
|
||||
From: John Kacur <jkacur@redhat.com>
|
||||
Date: Tue, 6 Dec 2022 14:35:49 -0500
|
||||
Subject: rteval: xmlout.py: Convert to f-strings where possible
|
||||
|
||||
Convert xmlout.py to f-strings where possible
|
||||
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
---
|
||||
rteval/xmlout.py | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/rteval/xmlout.py b/rteval/xmlout.py
|
||||
index a955fb11c77a..b549cc87a2cc 100644
|
||||
--- a/rteval/xmlout.py
|
||||
+++ b/rteval/xmlout.py
|
||||
@@ -67,7 +67,7 @@ class XMLOut:
|
||||
|
||||
def __del__(self):
|
||||
if self.level > 0:
|
||||
- raise RuntimeError("XMLOut: open blocks at __del__ (last opened '%s')" % self.currtag.name)
|
||||
+ raise RuntimeError(f"XMLOut: open blocks at __del__ (last opened '{self.currtag.name}')")
|
||||
if self.xmldoc is not None:
|
||||
self.xmldoc.freeDoc()
|
||||
|
||||
@@ -131,7 +131,7 @@ class XMLOut:
|
||||
self.__parseToXML(n, v)
|
||||
node.addChild(n)
|
||||
else:
|
||||
- raise TypeError("unhandled type (%s) for value '%s'" % (type(data), str(data)))
|
||||
+ raise TypeError(f"unhandled type ({str(type(data))}) for value '{str(data)}'")
|
||||
|
||||
def close(self):
|
||||
if self.status == 0:
|
||||
@@ -139,7 +139,7 @@ class XMLOut:
|
||||
if self.status == 3:
|
||||
raise RuntimeError("XMLOut: XML document already closed")
|
||||
if self.level > 0:
|
||||
- raise RuntimeError("XMLOut: open blocks at close() (last opened '%s')" % self.currtag.name)
|
||||
+ raise RuntimeError(f"XMLOut: open blocks at close() (last opened '{self.currtag.name}')")
|
||||
|
||||
if self.status == 1: # Only set the root node in the doc on created reports (NewReport called)
|
||||
self.xmldoc.setRootElement(self.xmlroot)
|
||||
@@ -172,7 +172,7 @@ class XMLOut:
|
||||
root = self.xmldoc.children
|
||||
if root.name != self.roottag:
|
||||
self.status = 3
|
||||
- raise RuntimeError("XMLOut: Loaded report is not a valid %s XML file" % self.roottag)
|
||||
+ raise RuntimeError(f"XMLOut: Loaded report is not a valid {self.roottag} XML file")
|
||||
|
||||
if validate_version is True:
|
||||
ver = root.hasProp('version')
|
||||
@@ -183,7 +183,7 @@ class XMLOut:
|
||||
|
||||
if ver.getContent() != self.version:
|
||||
self.status = 3
|
||||
- raise RuntimeError("XMLOut: Loaded report is not of version %s" % self.version)
|
||||
+ raise RuntimeError(f"XMLOut: Loaded report is not of version {self.version}")
|
||||
|
||||
self.status = 2 # Confirm that we have loaded a report from file
|
||||
|
||||
--
|
||||
2.40.1
|
||||
|
65
rteval.spec
65
rteval.spec
@ -1,6 +1,6 @@
|
||||
Name: rteval
|
||||
Version: 3.5
|
||||
Release: 9%{?dist}
|
||||
Version: 3.7
|
||||
Release: 1%{?dist}
|
||||
Summary: Utility to evaluate system suitability for RT Linux
|
||||
|
||||
Group: Development/Tools
|
||||
@ -33,34 +33,7 @@ Requires: libmpc libmpc-devel
|
||||
Obsoletes: rteval-common <= 3.1
|
||||
|
||||
#Patches
|
||||
Patch1: rteval-Replace-python-ethtool-with-inline-code.patch
|
||||
Patch2: Fix-DMI-WARNING-when-not-running-as-root.patch
|
||||
Patch3: rteval-Don-t-attempt-to-get-DMIinfo-if-there-are-dmi.patch
|
||||
Patch4: rteval-Catch-failures-in-python-dmidecode.patch
|
||||
Patch5: Added-code-to-check-if-the-proc-net-if_inet6-file-ex.patch
|
||||
Patch6: rteval-rteval-__init__.py-Convert-regular-strings-to.patch
|
||||
Patch7: rteval-rtevalReport.py-Convert-regular-strings-to-f-.patch
|
||||
Patch8: rteval-rtevalXMLRPC.py-Convert-regular-strings-to-f-.patch
|
||||
Patch9: rteval-rtevalConfig.py-Convert-regular-strings-to-f-.patch
|
||||
Patch10: rteval-xmlout.py-Convert-to-f-strings-where-possible.patch
|
||||
Patch11: rteval-Log.py-Convert-to-f-strings.patch
|
||||
Patch12: rteval-Use-f-strings-in-rtevalclient.py.patch
|
||||
Patch13: rteval-Use-f-strings-in-rtevalConfig.patch
|
||||
Patch14: rteval-Use-f-strings-in-kernel.py.patch
|
||||
Patch15: rteval-Use-f-strings-in-memory.py.patch
|
||||
Patch16: rteval-Use-f-strings-in-osinfo.patch
|
||||
Patch17: rteval-Use-f-strings-in-services.py.patch
|
||||
Patch18: rteval-Use-f-strings-in-tools.py.patch
|
||||
Patch19: rteval-Use-f-strings-in-cputopology.patch
|
||||
Patch20: rteval-Changed-files-to-use-argparse.patch
|
||||
Patch21: rteval-server-edited-files-to-use-optparse.patch
|
||||
Patch22: rteval-Detect-isolcpus-in-systopology.patch
|
||||
Patch23: rteval-Report-isolated-CPUs.patch
|
||||
Patch24: rteval-Exclude-isolcpus-from-kcompile-by-default.patch
|
||||
Patch25: rteval-Exclude-isolcpus-from-stressng-by-default.patch
|
||||
Patch26: rteval-Fix-CPU-count-calculation-for-hackbench.patch
|
||||
Patch27: rteval-Exclude-isolcpus-from-loads-report.patch
|
||||
Patch28: rteval-Add-missing-docstrings-in-SysTopology.patch
|
||||
Patch1: Revert-rteval-Change-the-default-kernel.patch
|
||||
|
||||
|
||||
%description
|
||||
@ -75,33 +48,6 @@ to the screen.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
|
||||
%build
|
||||
%{__python3} setup.py build
|
||||
@ -135,6 +81,11 @@ to the screen.
|
||||
%{python3_sitelib}/rteval/__pycache__/*
|
||||
|
||||
%changelog
|
||||
* Wed Oct 25 2023 John Kacur <jkacur@redhat.com> - 3.7-1
|
||||
- Rebase to upstream rteval-3.7
|
||||
- Revert the change to use a newer default kernel
|
||||
Resolves: RHEL-8967
|
||||
|
||||
* Thu Oct 05 2023 Tomas Glozar <tglozar@redhat.com> - 3.5-9
|
||||
- Added patch set that enables rteval to do load calculations and reporting
|
||||
correctly on systems with isolated CPUs
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (rteval-3.5.tar.xz) = 728e175acbc8170344c4e7bd191089239c6e05d05040458c4faac33c98241012058633955b1256b5fb0960f3e9c61bf2915b6e95b0216e3375c1ce5022ec995f
|
||||
SHA512 (rteval-3.7.tar.xz) = f6010fae457144e21b122746808411a6071b0c1db7d763bcf9e409fb570fc542c7463647ded77118534574f8d476f68576902af191a4edf8c296233a63704660
|
||||
|
Loading…
Reference in New Issue
Block a user