|
|
ad7215 |
From f857c822256d512d351cda0d8fa4d5d255d1e64f Mon Sep 17 00:00:00 2001
|
|
|
ad7215 |
From: Leah Leshchinsky <lleshchi@redhat.com>
|
|
|
ad7215 |
Date: Wed, 2 Feb 2022 15:18:27 -0500
|
|
|
ad7215 |
Subject: [PATCH 2/5] tuna: Handle get_policy_and_rtprio exceptions
|
|
|
ad7215 |
|
|
|
ad7215 |
In tuna-cmd.py, if a thread list is passed along with the
|
|
|
ad7215 |
'--priority' flag, tuna.get_policy_and_rtprio() is called twice, first
|
|
|
ad7215 |
directly, and then again by tuna.threads_set_priority(). The
|
|
|
ad7215 |
expectation is that tuna.threads_set_priority will handle exceptions
|
|
|
ad7215 |
raised by tuna.get_policy_and_rtprio(). This results in a failure to
|
|
|
ad7215 |
handle exceptions that are raised by the initial direct call to
|
|
|
ad7215 |
tuna.get_policy_and_rtprio().
|
|
|
ad7215 |
|
|
|
ad7215 |
Handle exceptions that may be raised during direct calls to
|
|
|
ad7215 |
get_policy_and_rtprio in tuna-cmd.py.
|
|
|
ad7215 |
|
|
|
ad7215 |
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
|
|
|
ad7215 |
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
|
ad7215 |
|
|
|
ad7215 |
diff --git a/tuna-cmd.py b/tuna-cmd.py
|
|
|
ad7215 |
index cf117ec046ff..2b6e91bd0104 100755
|
|
|
ad7215 |
--- a/tuna-cmd.py
|
|
|
ad7215 |
+++ b/tuna-cmd.py
|
|
|
ad7215 |
@@ -601,7 +601,11 @@ def main():
|
|
|
ad7215 |
tuna.include_cpus(cpu_list, get_nr_cpus())
|
|
|
ad7215 |
elif o in ("-p", "--priority"):
|
|
|
ad7215 |
# Save policy and rtprio for future Actions (e.g. --run).
|
|
|
ad7215 |
- (policy, rtprio) = tuna.get_policy_and_rtprio(a)
|
|
|
ad7215 |
+ try:
|
|
|
ad7215 |
+ (policy, rtprio) = tuna.get_policy_and_rtprio(a)
|
|
|
ad7215 |
+ except ValueError:
|
|
|
ad7215 |
+ print("tuna: " + _("\"%s\" is an unsupported priority value!") % a)
|
|
|
ad7215 |
+ sys.exit(2)
|
|
|
ad7215 |
if not thread_list:
|
|
|
ad7215 |
# For backward compatibility
|
|
|
ad7215 |
p_waiting_action = True
|
|
|
ad7215 |
--
|
|
|
ad7215 |
2.27.0
|
|
|
ad7215 |
|