You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/29 11:26:00 UTC

git commit: updated refs/heads/master to ade13bb

Updated Branches:
  refs/heads/master 9c36ad722 -> ade13bb77


Remove duplicate while-loop retries during ssh

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 53feae08de5f4d8072538e9060e5a6e074ebcdde)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ade13bb7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ade13bb7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ade13bb7

Branch: refs/heads/master
Commit: ade13bb7733b00b71dbc88e92bc67346c0683abc
Parents: 9c36ad7
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jul 29 14:51:37 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jul 29 14:52:07 2013 +0530

----------------------------------------------------------------------
 .../component/test_vpc_network_pfrules.py       |  2 +-
 tools/marvin/marvin/integration/lib/utils.py    | 30 +++++++++-----------
 tools/marvin/marvin/remoteSSHClient.py          |  4 +--
 3 files changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ade13bb7/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index 6894c99..9e6243b 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -356,7 +356,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
                                             vpcid=self.vpc.id
                                             )
 
-        self.debug("Adding NetwrokACl rules to make NAT rule accessible")
+        self.debug("Adding NetworkACL rules to make NAT rule accessible")
         nwacl_nat = NetworkACL.create(self.apiclient,
                                                 networkid=network.id,
                                                 services=services,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ade13bb7/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index 16bbb7e..92aee83 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -111,23 +111,19 @@ def cleanup_resources(api_client, resources):
 
 def is_server_ssh_ready(ipaddress, port, username, password, retries=5, timeout=20, keyPairFileLocation=None):
     """Return ssh handle else wait till sshd is running"""
-    loop_cnt = retries
-    while True:
-        try:
-            ssh = remoteSSHClient(
-                host=ipaddress,
-                port=port,
-                user=username,
-                passwd=password,
-                keyPairFileLocation=keyPairFileLocation)
-        except Exception as e:
-            if loop_cnt == 0:
-                raise e
-            loop_cnt = loop_cnt - 1
-            time.sleep(timeout)
-        else:
-            return ssh
-    raise Exception("Failed to bring up ssh service in time. Waited %ss" % retries*timeout)
+    try:
+        ssh = remoteSSHClient(
+            host=ipaddress,
+            port=port,
+            user=username,
+            passwd=password,
+            keyPairFileLocation=keyPairFileLocation,
+            retries=retries,
+            delay=timeout)
+    except Exception, e:
+        raise Exception("Failed to bring up ssh service in time. Waited %ss. Error is %s" % (retries * timeout, e))
+    else:
+        return ssh
 
 
 def format_volume_to_ext3(ssh_client, device="/dev/sda"):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ade13bb7/tools/marvin/marvin/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index 597fc65..1dd1ef1 100644
--- a/tools/marvin/marvin/remoteSSHClient.py
+++ b/tools/marvin/marvin/remoteSSHClient.py
@@ -24,7 +24,7 @@ from contextlib import closing
 
 
 class remoteSSHClient(object):
-    def __init__(self, host, port, user, passwd, retries=10,
+    def __init__(self, host, port, user, passwd, retries=10, delay=5,
                  log_lvl=logging.INFO, keyPairFileLocation=None):
         self.host = host
         self.port = port
@@ -62,7 +62,7 @@ class remoteSSHClient(object):
                     raise cloudstackException. \
                         InvalidParameterException(repr(sshex))
                 retry_count = retry_count - 1
-                time.sleep(5)
+                time.sleep(delay)
             except paramiko.AuthenticationException, authEx:
                 raise cloudstackException. \
                     InvalidParameterException("Invalid credentials to "