From cc88ce14dbbcb59a5644274b3e4e451dbe2351a2 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Thu, 20 Oct 2016 14:15:44 +0300 Subject: [PATCH] Remove 'fork' option from socat command socat should not forks for each new connection. After this change socat console will be available only for single user connection and will be closed after user connection close. To connect again, user should re-activate console. This already covered in nova virt driver. Also added timeout check for 600 sec for user's connection. Change-Id: If92b3a9cff2d0fc1280f8e9dfc4bc8fa100c91ec Closes-bug: #1611279 --- ironic/drivers/modules/console_utils.py | 8 ++++++-- .../notes/fix-socat-command-afc840284446870a.yaml | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 ironic/releasenotes/notes/fix-socat-command-afc840284446870a.yaml diff --git a/ironic/drivers/modules/console_utils.py b/ironic/drivers/modules/console_utils.py index c8195ddf2b..55358a66e7 100644 --- a/ironic/drivers/modules/console_utils.py +++ b/ironic/drivers/modules/console_utils.py @@ -282,13 +282,17 @@ def start_socat_console(node_uuid, port, console_cmd): # put together the command and arguments for invoking the console args = ['socat'] + # set timeout check for user's connection. After 10min of inactivity + # on client side, connection will be closed. + # TODO(ashestakov) Make timeout value configurable + args.append('-T600') args.append('-L%s' % pid_file) console_host = CONF.my_ip if netutils.is_valid_ipv6(console_host): - arg = 'TCP6-LISTEN:%(port)s,bind=[%(host)s],reuseaddr,fork' + arg = 'TCP6-LISTEN:%(port)s,bind=[%(host)s],reuseaddr' else: - arg = 'TCP4-LISTEN:%(port)s,bind=%(host)s,reuseaddr,fork' + arg = 'TCP4-LISTEN:%(port)s,bind=%(host)s,reuseaddr' args.append(arg % {'host': console_host, 'port': port}) diff --git a/ironic/releasenotes/notes/fix-socat-command-afc840284446870a.yaml b/ironic/releasenotes/notes/fix-socat-command-afc840284446870a.yaml new file mode 100644 index 0000000000..85b55e5912 --- /dev/null +++ b/ironic/releasenotes/notes/fix-socat-command-afc840284446870a.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - Fixes issue with socat console support where an unlimited + number of connections could be created, resulting in the prior + session being destroyed. Connections are now limited + to a single connection per server. Socat now closes the + console connection upon disconnect or timeout 10min. To reconnect, + users should re-activate the console.