From 02541dfb5cf43f8c6436302dcd359cdec945677c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Sat, 2 Jun 2018 08:26:29 +0200 Subject: [PATCH] scheduler: Catch OSError in addition to IOError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In python3, functions such as open() or readline() raise OSError instead of IOError. Signed-off-by: Ondřej Lysoněk --- tuned/plugins/plugin_scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tuned/plugins/plugin_scheduler.py b/tuned/plugins/plugin_scheduler.py index bb14076..f504dc7 100644 --- a/tuned/plugins/plugin_scheduler.py +++ b/tuned/plugins/plugin_scheduler.py @@ -204,14 +204,14 @@ class SchedulerPlugin(base.Plugin): return 0 else: return 1 - except IOError as e: + except (OSError, IOError) as e: if e.errno == errno.ENOENT or e.errno == errno.ESRCH: log.debug("Unable to set affinity for PID %s, the task vanished." % pid) return -1 else: log.error("Failed to get task info for PID %s: %s" % (pid, str(e))) return -2 - except (OSError, AttributeError, KeyError) as e: + except (AttributeError, KeyError) as e: log.error("Failed to get task info for PID %s: %s" % (pid, str(e))) return -2