summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-05-07 16:02:00 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-05-20 23:37:44 +0200
commitc0cdaa5bbf3294cd3d9fb3c3b0dd6acd38684daa (patch)
tree395b0edeb53cbb193ed3ac89ce0c9a5a57813eb0
parent7a0523598bf26d1d0dd95e27b4c38a2deb56b37c (diff)
Improve ssh timeout in vping_ssh
It seems that 10s is not enough for Fuel. Change-Id: I46d3d2c9091946befb0e056a8c8cc56c59087471 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit e1e1317226b4022b6e77ae7ddcc9a1ef9d8ccbd2)
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_ssh.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index 8cc251d1d..933779ec1 100644
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -97,13 +97,25 @@ class VPingSSH(vping_base.VPingBase):
return testcase.TestCase.EX_RUN_ERROR
def _do_vping(self):
- time.sleep(10)
self.ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
- self.ssh.connect(
- self.vm2.public_v4,
- username=getattr(config.CONF, 'openstack_image_user'),
- key_filename=self.key_filename,
- timeout=getattr(config.CONF, 'vping_vm_ssh_connect_timeout'))
+ for loop in range(6):
+ try:
+ self.ssh.connect(
+ self.vm2.public_v4,
+ username=getattr(config.CONF, 'openstack_image_user'),
+ key_filename=self.key_filename,
+ timeout=getattr(
+ config.CONF, 'vping_vm_ssh_connect_timeout'))
+ break
+ except Exception: # pylint: disable=broad-except
+ self.logger.info(
+ "try %s: cannot connect to %s", loop + 1,
+ self.vm2.public_v4)
+ time.sleep(10)
+ else:
+ self.logger.error("cannot connect to %s", self.vm2.public_v4)
+ return False
+
self.logger.debug("ssh: %s", self.ssh)
(_, stdout, _) = self.ssh.exec_command(
'ping -c 1 ' + self.vm1.private_v4)