summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-04 15:10:27 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-04 17:11:47 +0200
commit4e303f8ecd9ea41d05974d0100afe751c0ba2c68 (patch)
treee7df9fb66181e1325d486e3a0245b62357593e15
parent3532b0cc15d1266e95ea0d5645d587c9f18b2efa (diff)
Make synchronous Shade calls
It makes difficult to find the issues (floating ip, boot, ssh connection, etc...) for a small benefit regarding the current testcase implementations. It increases the default floating ip timeout because it has been reached when running Functest multiple times in parallel. It may be the root cause when running singlevm vs XCI (in that case, neutron api and agents are hosted in a nested vm). Change-Id: Ia97e04902321644c207c59987283754318aee5e5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 8faf2e3365fc5acc0167a05a919eef564f11491a)
-rw-r--r--functest/core/singlevm.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py
index 7393fdbe3..1de355e0d 100644
--- a/functest/core/singlevm.py
+++ b/functest/core/singlevm.py
@@ -83,7 +83,8 @@ class VmReady1(tenantnetwork.TenantNetwork1):
self.image_format),
visibility=getattr(
config.CONF, '{}_visibility'.format(self.case_name),
- self.visibility))
+ self.visibility),
+ wait=True)
self.__logger.debug("image: %s", image)
return image
@@ -112,7 +113,8 @@ class VmReady1(tenantnetwork.TenantNetwork1):
self.image_format),
visibility=getattr(
config.CONF, '{}_visibility'.format(self.case_name),
- self.visibility))
+ self.visibility),
+ wait=True)
self.__logger.debug("image: %s", image)
return image
@@ -293,8 +295,9 @@ class SingleVm1(VmReady1):
__logger = logging.getLogger(__name__)
username = 'cirros'
- ssh_connect_timeout = 60
+ ssh_connect_timeout = 1
ssh_connect_loops = 6
+ create_floating_ip_timeout = 120
def __init__(self, **kwargs):
if "case_name" not in kwargs:
@@ -343,14 +346,15 @@ class SingleVm1(VmReady1):
"""
assert vm1
fip = self.cloud.create_floating_ip(
- network=self.ext_net.id, server=vm1)
+ network=self.ext_net.id, server=vm1, wait=True,
+ timeout=self.create_floating_ip_timeout)
self.__logger.debug("floating_ip: %s", fip)
- p_console = self.cloud.get_server_console(vm1)
- self.__logger.debug("vm console: \n%s", p_console)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
for loop in range(self.ssh_connect_loops):
try:
+ p_console = self.cloud.get_server_console(vm1)
+ self.__logger.debug("vm console: \n%s", p_console)
ssh.connect(
fip.floating_ip_address,
username=getattr(
@@ -362,11 +366,11 @@ class SingleVm1(VmReady1):
'{}_vm_ssh_connect_timeout'.format(self.case_name),
self.ssh_connect_timeout))
break
- except Exception: # pylint: disable=broad-except
+ except Exception as exc: # pylint: disable=broad-except
self.__logger.debug(
- "try %s: cannot connect to %s", loop + 1,
- fip.floating_ip_address)
- time.sleep(10)
+ "try %s: cannot connect to %s: %s", loop + 1,
+ fip.floating_ip_address, exc)
+ time.sleep(9)
else:
self.__logger.error(
"cannot connect to %s", fip.floating_ip_address)