Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 335A710A55 for ; Thu, 1 Aug 2013 01:27:59 +0000 (UTC) Received: (qmail 64570 invoked by uid 500); 1 Aug 2013 01:27:59 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 64553 invoked by uid 500); 1 Aug 2013 01:27:59 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 64546 invoked by uid 99); 1 Aug 2013 01:27:59 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Aug 2013 01:27:59 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9D9908B5418; Thu, 1 Aug 2013 01:27:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yasker@apache.org To: commits@cloudstack.apache.org Message-Id: <27c698f0f34446b984b36c5c9ea74f40@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to fda0553 Date: Thu, 1 Aug 2013 01:27:58 +0000 (UTC) Updated Branches: refs/heads/4.2 7acb023aa -> fda055388 Automation: Fix SSH connection test And increase default retry to 10 times, each 30 seconds. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fda05538 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fda05538 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fda05538 Branch: refs/heads/4.2 Commit: fda055388e3776cb630e167340f887b4f329339f Parents: 7acb023 Author: Sheng Yang Authored: Wed Jul 31 18:27:11 2013 -0700 Committer: Sheng Yang Committed: Wed Jul 31 18:27:49 2013 -0700 ---------------------------------------------------------------------- tools/marvin/marvin/integration/lib/utils.py | 2 +- tools/marvin/marvin/remoteSSHClient.py | 24 ++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fda05538/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 2da9272..6d10132 100644 --- a/tools/marvin/marvin/integration/lib/utils.py +++ b/tools/marvin/marvin/integration/lib/utils.py @@ -109,7 +109,7 @@ def cleanup_resources(api_client, resources): obj.delete(api_client) -def is_server_ssh_ready(ipaddress, port, username, password, retries=5, timeout=30, keyPairFileLocation=None): +def is_server_ssh_ready(ipaddress, port, username, password, retries=10, timeout=30, keyPairFileLocation=None): """Return ssh handle else wait till sshd is running""" try: ssh = remoteSSHClient( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fda05538/tools/marvin/marvin/remoteSSHClient.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py index e0ead93..fea9b12 100644 --- a/tools/marvin/marvin/remoteSSHClient.py +++ b/tools/marvin/marvin/remoteSSHClient.py @@ -17,7 +17,6 @@ import paramiko import time -import socket import cloudstackException import contextlib import logging @@ -25,7 +24,7 @@ from contextlib import closing class remoteSSHClient(object): - def __init__(self, host, port, user, passwd, retries=5, delay=30, + def __init__(self, host, port, user, passwd, retries=10, delay=30, log_lvl=logging.INFO, keyPairFileLocation=None): self.host = host self.port = port @@ -40,7 +39,7 @@ class remoteSSHClient(object): self.logger.addHandler(ch) retry_count = retries - while True: + while retry_count >= 0: try: if keyPairFileLocation is None: self.ssh.connect(str(host), int(port), user, passwd) @@ -58,17 +57,20 @@ class remoteSSHClient(object): (str(host), user, keyPairFileLocation)) self.logger.debug("SSH connect: %s@%s with passwd %s" % (user, str(host), passwd)) - except (paramiko.SSHException, paramiko.ChannelException, socket.error) as se: + #except paramiko.AuthenticationException, authEx: + # raise cloudstackException. \ + # InvalidParameterException("Invalid credentials to " + # + "login to %s on port %s" % + # (str(host), port)) + except Exception as se: if retry_count == 0: raise cloudstackException. \ InvalidParameterException(repr(se)) - retry_count = retry_count - 1 - time.sleep(delay) - except paramiko.AuthenticationException, authEx: - raise cloudstackException. \ - InvalidParameterException("Invalid credentials to " - + "login to %s on port %s" % - (str(host), port)) + else: + return + + retry_count = retry_count - 1 + time.sleep(delay) def execute(self, command): stdin, stdout, stderr = self.ssh.exec_command(command)