Updated Branches: refs/heads/4.2 798c507c7 -> 7aafd06df
Include SSH retry logic when encountering channel failures. Only on SSHExceptions we attempted retries, but during socket failures, like Network Unreachable we failed the ssh connection immediately. Signed-off-by: Prasanna Santhanam <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7aafd06d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7aafd06d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7aafd06d Branch: refs/heads/4.2 Commit: 7aafd06df6a5c8fffe336e0168de6d5fe22083b3 Parents: 805d087 Author: Prasanna Santhanam <[email protected]> Authored: Wed Jul 31 17:16:48 2013 +0530 Committer: Prasanna Santhanam <[email protected]> Committed: Wed Jul 31 17:21:01 2013 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/integration/lib/utils.py | 2 +- tools/marvin/marvin/remoteSSHClient.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7aafd06d/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 92aee83..2da9272 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=20, keyPairFileLocation=None): +def is_server_ssh_ready(ipaddress, port, username, password, retries=5, 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/7aafd06d/tools/marvin/marvin/remoteSSHClient.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py index 764ba2e..e0ead93 100644 --- a/tools/marvin/marvin/remoteSSHClient.py +++ b/tools/marvin/marvin/remoteSSHClient.py @@ -17,6 +17,7 @@ import paramiko import time +import socket import cloudstackException import contextlib import logging @@ -57,10 +58,10 @@ class remoteSSHClient(object): (str(host), user, keyPairFileLocation)) self.logger.debug("SSH connect: %s@%s with passwd %s" % (user, str(host), passwd)) - except paramiko.SSHException, sshex: + except (paramiko.SSHException, paramiko.ChannelException, socket.error) as se: if retry_count == 0: raise cloudstackException. \ - InvalidParameterException(repr(sshex)) + InvalidParameterException(repr(se)) retry_count = retry_count - 1 time.sleep(delay) except paramiko.AuthenticationException, authEx: @@ -68,8 +69,6 @@ class remoteSSHClient(object): InvalidParameterException("Invalid credentials to " + "login to %s on port %s" % (str(host), port)) - else: - return self.ssh def execute(self, command): stdin, stdout, stderr = self.ssh.exec_command(command)
