diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-05-07 16:02:00 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-05-07 16:02:00 +0200 |
commit | e1e1317226b4022b6e77ae7ddcc9a1ef9d8ccbd2 (patch) | |
tree | e8b5cfd236d97bb857f4ec310f6e75188fcc2624 | |
parent | 213ca8e4e4d155ed6d5626020e56c3a241d1dace (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>
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_ssh.py | 24 |
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) |