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/31 13:51:12 UTC

[1/2] git commit: updated refs/heads/4.2 to 7aafd06

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 <ts...@apache.org>


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 <ts...@apache.org>
Authored: Wed Jul 31 17:16:48 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
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)


[2/2] git commit: updated refs/heads/4.2 to 7aafd06

Posted by ts...@apache.org.
Cleanup the marvin logger

It is useful to have the same logger used in the marvinplugin into the
testcase. The testcase can then append its name to the logger making
the logs specify exactly which test is executing when the logs are
generated

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/4.2
Commit: 805d087d8761299a2df5a6fc01da30c1dc42a368
Parents: 798c507
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed Jul 31 15:18:04 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed Jul 31 17:21:01 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/marvinPlugin.py    | 20 ++++----------------
 tools/marvin/marvin/remoteSSHClient.py |  4 ++--
 2 files changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/805d087d/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index 2949109..f7b0664 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -25,11 +25,6 @@ from nose.plugins.base import Plugin
 from functools import partial
 
 
-def testCaseLogger(message, logger=None):
-    if logger is not None:
-        logger.debug(message)
-
-
 class MarvinPlugin(Plugin):
     """
     Custom plugin for the cloudstackTestCases to be run using nose
@@ -69,10 +64,6 @@ class MarvinPlugin(Plugin):
         self.setClient(deploy.testClient)
         self.setConfig(deploy.getCfg())
 
-        cfg = nose.config.Config()
-        cfg.logStream = self.result_stream
-        cfg.debugLog = self.debug_stream
-
         self.testrunner = nose.core.TextTestRunner(stream=self.result_stream,
                                                    descriptions=True,
                                                    verbosity=2, config=config)
@@ -133,21 +124,18 @@ class MarvinPlugin(Plugin):
     def beforeTest(self, test):
         testname = test.__str__().split()[0]
         self.testclient.identifier = '-'.join([self.identifier, testname])
+        self.logger.name = test.__str__()
 
     def _injectClients(self, test):
-        testcaselogger = logging.getLogger("testclient.testcase.%s" %
-                                           test.__name__)
         self.debug_stream. \
             setFormatter(logging.
                          Formatter("%(asctime)s - %(levelname)s - %(name)s" +
                                    " - %(message)s"))
-
-        testcaselogger.addHandler(self.debug_stream)
-        testcaselogger.setLevel(logging.DEBUG)
-
+        setattr(test, "debug", self.logger.debug)
+        setattr(test, "info", self.logger.info)
+        setattr(test, "warn", self.logger.warning)
         setattr(test, "testClient", self.testclient)
         setattr(test, "config", self.config)
-        setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger))
         if self.testclient.identifier is None:
             self.testclient.identifier = self.identifier
         setattr(test, "clstestclient", self.testclient)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/805d087d/tools/marvin/marvin/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index 1dd1ef1..764ba2e 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, delay=5,
+    def __init__(self, host, port, user, passwd, retries=5, delay=30,
                  log_lvl=logging.INFO, keyPairFileLocation=None):
         self.host = host
         self.port = port
@@ -69,7 +69,7 @@ class remoteSSHClient(object):
                                               + "login to %s on port %s" %
                                               (str(host), port))
             else:
-                return
+                return self.ssh
 
     def execute(self, command):
         stdin, stdout, stderr = self.ssh.exec_command(command)