Discussion:
tuna: print an error message when sched_setaffinity returns EINVAL
John Kacur
2015-12-10 14:53:50 UTC
Permalink
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
Cannot move thread

Reported-by: Guy Streeter <***@redhat.com>
Signed-off-by: John Kacur <***@redhat.com>

(see attachment for actual patch)

Loading...