diff options
author | John Kacur <jkacur@redhat.com> | 2015-12-10 15:14:18 +0100 |
---|---|---|
committer | Jiri Kastner <jkastner@redhat.com> | 2016-05-16 10:55:44 +0200 |
commit | 6cfb861b9c7188901ac629eb012f1085f49049b5 (patch) | |
tree | f62ad2a716f2656d22bcb7eac66df4ddf9a399ef | |
parent | 8061e72442f4d00be6b58ae083544f51a3081c1e (diff) | |
download | tuna-6cfb861b9c7188901ac629eb012f1085f49049b5.tar.gz |
tuna: print an error message when sched_setaffinity returns EINVALdevel-0.13
When you attempt to move a thread that cannot be moved,
schedutils.sched_setaffinity() throws an EINVAL OSError exception. tuna
does not capture this, so the command exits with a Python traceback
instead of an error message.
eg:
tuna --cpus=0 --threads=migration/1 --move
Traceback (most recent call last):
File "/bin/tuna", line 656, in <module>
main()
File "/bin/tuna", line 572, in main
spread = spread)
File "/usr/lib/python2.7/site-packages/tuna/tuna.py", line 265, in
move_threads_to_cpu
raise e
OSError: [Errno 22] Invalid argument
This change handles that situation and exits more gracefully with
an error message like this
tuna --cpus=0 --threads="migration/1" --move
thread 14 cannot be moved as requested
or with multiple threads
tuna --cpus=0 --threads="migration/*" --move
thread 28 cannot be moved as requested
thread 21 cannot be moved as requested
thread 14 cannot be moved as requested
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
-rwxr-xr-x | tuna/tuna.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tuna/tuna.py b/tuna/tuna.py index 1de63b0..646b8df 100755 --- a/tuna/tuna.py +++ b/tuna/tuna.py @@ -271,6 +271,9 @@ def move_threads_to_cpu(cpus, pid_list, set_affinity_warning = None, if e[0] == 3: # process died continue + elif e[0] == 22: # (22, EINVAL - unmovable thread) + print "thread %(pid)d cannot be moved as requested" %{'pid':pid} + continue raise e return changed |