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
This commit is contained in:
Kaifeng Wang 2023-01-26 21:21:30 +08:00 committed by Julia Kreger
parent b63d15ccdb
commit 88c4271a70
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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.