libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1343529 - in /libcloud/trunk: CHANGES libcloud/compute/base.py
Date Tue, 29 May 2012 04:21:12 GMT
Author: tomaz
Date: Tue May 29 04:21:12 2012
New Revision: 1343529

URL: http://svn.apache.org/viewvc?rev=1343529&view=rev
Log:
Add time.sleep(wait_period) to _ssh_client_connect to prevent busy loops
when we immediately can't connect to a server. This patch has been contributed
by Jay Doane and is part of LIBCLOUD-197.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/base.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1343529&r1=1343528&r2=1343529&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Tue May 29 04:21:12 2012
@@ -7,6 +7,10 @@ Changes with Apache Libcloud in developm
       ; LIBCLOUD-199
       [Chris Gilmer]
 
+    - Add time.sleep(wait_period) to _ssh_client_connect to prevent busy loops
+      when we immediately can't connect to a server. ; LIBCLOUD-197
+      [Jay Doane]
+
 Changes with Apache Libcloud 0.10.1:
 
   *) General:

Modified: libcloud/trunk/libcloud/compute/base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/base.py?rev=1343529&r1=1343528&r2=1343529&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/base.py (original)
+++ libcloud/trunk/libcloud/compute/base.py Tue May 29 04:21:12 2012
@@ -667,7 +667,7 @@ class NodeDriver(BaseDriver):
         raise LibcloudError(value='Timed out after %s seconds' % (timeout),
                             driver=self)
 
-    def _ssh_client_connect(self, ssh_client, timeout=300):
+    def _ssh_client_connect(self, ssh_client, wait_period=1.5, timeout=300):
         """
         Try to connect to the remote SSH server. If a connection times out or
         is refused it is retried up to timeout number of seconds.
@@ -675,6 +675,10 @@ class NodeDriver(BaseDriver):
         @keyword    ssh_client: A configured SSHClient instance
         @type       ssh_client: C{SSHClient}
 
+        @keyword    wait_period: How many seconds to wait between each loop
+                                 iteration (default is 1.5)
+        @type       wait_period: C{int}
+
         @keyword    timeout: How many seconds to wait before timing out
                              (default is 600)
         @type       timeout: C{int}
@@ -691,6 +695,7 @@ class NodeDriver(BaseDriver):
                 # Retry if a connection is refused or timeout
                 # occurred
                 ssh_client.close()
+                time.sleep(wait_period)
                 continue
             else:
                 return ssh_client



Mime
View raw message