Merge "Change ssh_utils parameter to correctly sends keepalive packets"
This commit is contained in:
commit
bcc7ec775b
@ -136,16 +136,8 @@ class SSHPool(pools.Pool):
|
|||||||
msg = _("Specify a password or private_key")
|
msg = _("Specify a password or private_key")
|
||||||
raise exception.CinderException(msg)
|
raise exception.CinderException(msg)
|
||||||
|
|
||||||
# Paramiko by default sets the socket timeout to 0.1 seconds,
|
|
||||||
# ignoring what we set through the sshclient. This doesn't help for
|
|
||||||
# keeping long lived connections. Hence we have to bypass it, by
|
|
||||||
# overriding it after the transport is initialized. We are setting
|
|
||||||
# the sockettimeout to None and setting a keepalive packet so that,
|
|
||||||
# the server will keep the connection open. All that does is send
|
|
||||||
# a keepalive packet every ssh_conn_timeout seconds.
|
|
||||||
if self.conn_timeout:
|
if self.conn_timeout:
|
||||||
transport = ssh.get_transport()
|
transport = ssh.get_transport()
|
||||||
transport.sock.settimeout(None)
|
|
||||||
transport.set_keepalive(self.conn_timeout)
|
transport.set_keepalive(self.conn_timeout)
|
||||||
return ssh
|
return ssh
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user