diff options
author | John Kacur <jkacur@redhat.com> | 2019-03-14 17:14:30 +0100 |
---|---|---|
committer | John Kacur <jkacur@redhat.com> | 2020-05-09 00:59:46 -0400 |
commit | bf8d64f99bf4724625ffa3e058fd7f1ca08ed13b (patch) | |
tree | 3390588fb10749892704beaa4e3004ed40a48b7b | |
parent | 411c75cb16a272dea89246f57c49ea9c9ec975a1 (diff) | |
download | tuna-bf8d64f99bf4724625ffa3e058fd7f1ca08ed13b.tar.gz |
tuna: Exit with error msg on s390 and s390x for unsupported irq ops
On s390 and s390x any operations involving irqs will fail.
Try to exit cleanly with an error message that these operations are
unsupported on s390 and s390x
Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-x | tuna/tuna.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tuna/tuna.py b/tuna/tuna.py index d1d9bad..ed44a29 100755 --- a/tuna/tuna.py +++ b/tuna/tuna.py @@ -4,6 +4,7 @@ import copy, ethtool, errno, os, procfs, re, schedutils, sys, shlex from . import help import fnmatch +import platform from procfs import utilist try: @@ -317,9 +318,24 @@ def affinity_remove_cpus(affinity, cpus, nr_cpus): affinity = list(set(affinity) - set(cpus)) return affinity +# True if machine is s390 or s390x +def is_s390(): + machine = platform.machine() + if re.search('s390', machine): + return True + else: + return False + # Shound be moved to python_linux_procfs.interrupts, shared with interrupts.parse_affinity, etc. def parse_irq_affinity_filename(filename, nr_cpus): - f = open("/proc/irq/%s" % filename) + try: + f = open("/proc/irq/%s" % filename) + except IOError as err: + if is_s390(): + print("This operation is not supported on s390", file=sys.stderr) + print("tuna: %s" % err, file=sys.stderr) + sys.exit(2) + line = f.readline() f.close() return utilist.bitmasklist(line, nr_cpus) |