From: Cédric Ollivier Date: Sat, 4 Aug 2018 13:10:27 +0000 (+0200) Subject: Make synchronous Shade calls X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F60579%2F1;p=functest.git 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 (cherry picked from commit 8faf2e3365fc5acc0167a05a919eef564f11491a) --- 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)