From 88c4271a7030fca0333fcea84cf8702990b263ca Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Thu, 26 Jan 2023 21:21:30 +0800 Subject: [PATCH] Relaxing console pid looking Recently we hit an issue that the pid file is missing, current logic simply removes pid file if the corresponding process is not found, but if the pid file is lost then the console could never be stopped and futher more, be restarted, regardless if the process is there or not. This patch captures FileNotFound to the exception handling to allow console recovery. Change-Id: I1a0b8347e960c6cff8aca10a22c67b710f7d617e --- ironic/drivers/modules/console_utils.py | 2 +- releasenotes/notes/console-pid-file-6108d2775ef947fe.yaml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/console-pid-file-6108d2775ef947fe.yaml diff --git a/ironic/drivers/modules/console_utils.py b/ironic/drivers/modules/console_utils.py index 6e08b67128..c5e9e857a3 100644 --- a/ironic/drivers/modules/console_utils.py +++ b/ironic/drivers/modules/console_utils.py @@ -90,7 +90,7 @@ def _get_console_pid(node_uuid): with open(pid_path, 'r') as f: pid_str = f.readline() return int(pid_str) - except (IOError, ValueError): + except (IOError, ValueError, FileNotFoundError): raise exception.NoConsolePid(pid_path=pid_path) diff --git a/releasenotes/notes/console-pid-file-6108d2775ef947fe.yaml b/releasenotes/notes/console-pid-file-6108d2775ef947fe.yaml new file mode 100644 index 0000000000..427d04da85 --- /dev/null +++ b/releasenotes/notes/console-pid-file-6108d2775ef947fe.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue that when a node has console enabled but pid + file missing, the console could not be disabled as well as be + restarted, which makes the console feature unusable.