summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules
diff options
context:
space:
mode:
authortaoruizhe <taoruizhe@inspur.com>2021-12-28 14:38:36 +0800
committerJulia Kreger <juliaashleykreger@gmail.com>2022-01-20 18:42:14 +0000
commita2160f13af9559bd0a5b350f9317c21dc907feec (patch)
tree7662f0ce0971440f45c1614a7e8ab4f1e164a9bc /ironic/drivers/modules
parent097ec2f8eefec6ac8ae3bbc547d5b9975b9750ba (diff)
downloadironic-a2160f13af9559bd0a5b350f9317c21dc907feec.tar.gz
Fix Node Console Duplicate Sol Session
Restart node console may occasionally result in duplicated sol session. Especially, when a cluster deployed with multi ironic-conductor backends, stop_console action shutdown only one console process while another sol session remains. This patch adds "sol deactivate" action before start node console. Make sure the current connection always a success. Story: 2009762 Task: 44233 Change-Id: I5bc8666ff0b4ceab61ed6a8c794d6882783d6bce
Diffstat (limited to 'ironic/drivers/modules')
-rw-r--r--ironic/drivers/modules/ipmitool.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ironic/drivers/modules/ipmitool.py b/ironic/drivers/modules/ipmitool.py
index d5a699673..6c3dc678d 100644
--- a/ironic/drivers/modules/ipmitool.py
+++ b/ironic/drivers/modules/ipmitool.py
@@ -1560,6 +1560,13 @@ class IPMIShellinaboxConsole(IPMIConsole):
if not driver_info['port']:
driver_info['port'] = _allocate_port(task)
+ try:
+ self._exec_stop_console(driver_info)
+ except OSError:
+ # We need to drop any existing sol sessions with sol deactivate.
+ # OSError is raised when sol session is already deactivated,
+ # so we can ignore it.
+ pass
self._start_console(driver_info,
console_utils.start_shellinabox_console)
@@ -1577,6 +1584,10 @@ class IPMIShellinaboxConsole(IPMIConsole):
_console_pwfile_path(task.node.uuid))
_release_allocated_port(task)
+ def _exec_stop_console(self, driver_info):
+ cmd = "sol deactivate"
+ _exec_ipmitool(driver_info, cmd, check_exit_code=[0, 1])
+
@METRICS.timer('IPMIShellinaboxConsole.get_console')
def get_console(self, task):
"""Get the type and connection information about the console."""