Blob Blame History Raw
From d67b619dcddb5ed04d0ec69a62ce555a40896a50 Mon Sep 17 00:00:00 2001
From: Jan Zerdik <jzerdik@redhat.com>
Date: Thu, 9 Feb 2023 12:13:06 +0100
Subject: [PATCH] Fixing no _evlist attribute when run without daemon

Relates to: rhbz#2080227

Signed-off-by: Jan Zerdik <jzerdik@redhat.com>
---
 tuned/plugins/plugin_scheduler.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tuned/plugins/plugin_scheduler.py b/tuned/plugins/plugin_scheduler.py
index 6cbb77b..10ff4e7 100644
--- a/tuned/plugins/plugin_scheduler.py
+++ b/tuned/plugins/plugin_scheduler.py
@@ -446,6 +446,7 @@ class SchedulerPlugin(base.Plugin):
 				command_name = "scheduler")
 		self._irq_storage_key = self._storage_key(
 				command_name = "irq")
+		self._evlist = None
 		try:
 			self._scheduler_utils = SchedulerUtils()
 		except AttributeError:
@@ -526,8 +527,9 @@ class SchedulerPlugin(base.Plugin):
 				instance._runtime_tuning = False
 
 	def _instance_cleanup(self, instance):
-		for fd in instance._evlist.get_pollfd():
-			os.close(fd.name)
+		if self._evlist:
+			for fd in instance._evlist.get_pollfd():
+				os.close(fd.name)
 
 	@classmethod
 	def _get_config_options(cls):
-- 
2.39.1