summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Barron <tpb@dyncloud.net>2018-12-29 21:35:53 -0600
committerGoutham Pacha Ravi <gouthampravi@gmail.com>2019-01-05 00:48:23 +0000
commit1814ad41134a2fa952ea6b664984da07d46d17c3 (patch)
tree09311595335935f79c30381a9fb11dbb6a615576
parenta8daa9540c594b7b4317158e5aa555b8a2afc04f (diff)
Change ssh_utils parameter to correctly send keepalive packets
The current implementation of ssh_utils never sends keepalive packets. In ssh_utils.SSHPool, the socket timeout parameter is set to None intending to keep ssh connections open. However, when the parameter is set to None, ssh_utils does not run the code to compare idle duration and keepalive interval. This patch reverts the socket timeout parameter to default (0.1 sec). The ssh_utils compares them every 0.1 seconds, and sends a keepalive packet if idle duration > keepalive interval (= self.conn_timeout). See cinder change: I8234083107207b9ebc0849947e8de92b5cf3e36e Change-Id: Ib13e5c6246412d667554cb0bd9c419b513af70c7 Related-Bug: #1673662
Notes
Notes (review): Code-Review+2: Rodrigo Barbieri <rodrigo.barbieri2010@gmail.com> Code-Review+2: Thomas Bechtold <tbechtold@suse.com> Workflow+1: Goutham Pacha Ravi <gouthampravi@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 05 Jan 2019 03:10:47 +0000 Reviewed-on: https://review.openstack.org/627797 Project: openstack/manila Branch: refs/heads/master
-rw-r--r--manila/utils.py8
1 files changed, 0 insertions, 8 deletions
diff --git a/manila/utils.py b/manila/utils.py
index 05792db..b3aeb69 100644
--- a/manila/utils.py
+++ b/manila/utils.py
@@ -142,16 +142,8 @@ class SSHPool(pools.Pool):
142 look_for_keys=look_for_keys, 142 look_for_keys=look_for_keys,
143 timeout=self.conn_timeout, 143 timeout=self.conn_timeout,
144 banner_timeout=self.conn_timeout) 144 banner_timeout=self.conn_timeout)
145 # Paramiko by default sets the socket timeout to 0.1 seconds,
146 # ignoring what we set through the sshclient. This doesn't help for
147 # keeping long lived connections. Hence we have to bypass it, by
148 # overriding it after the transport is initialized. We are setting
149 # the sockettimeout to None and setting a keepalive packet so that,
150 # the server will keep the connection open. All that does is send
151 # a keepalive packet every ssh_conn_timeout seconds.
152 if self.conn_timeout: 145 if self.conn_timeout:
153 transport = ssh.get_transport() 146 transport = ssh.get_transport()
154 transport.sock.settimeout(None)
155 transport.set_keepalive(self.conn_timeout) 147 transport.set_keepalive(self.conn_timeout)
156 return ssh 148 return ssh
157 except Exception as e: 149 except Exception as e: