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