tuna: print an error message when sched_setaffinity returns EINVAL
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>
1 file changed