From 7332716dc835cd72b0beefc38afda2697bd99e02 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sun, 6 Oct 2019 20:43:02 +0200 Subject: Count all hypervisors by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If one hypervisor is down, few tempest test fails. User is free to set SKIP_DOWN_HYPERVISORS if it's down on purpose. Change-Id: I7b6a4d0d8f67755d8c1550fd1bc6fd707634f68b Signed-off-by: Cédric Ollivier --- functest/core/singlevm.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'functest/core') diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index 734eb22d5..5ecd482ac 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -256,12 +256,21 @@ class VmReady1(tenantnetwork.TenantNetwork1): self.__logger.debug( "Orphan security group %s in use", sec_group.id) + def count_hypervisors(self): + """Count hypervisors.""" + if env.get('SKIP_DOWN_HYPERVISORS').lower() == 'false': + return len(self.orig_cloud.list_hypervisors()) + return self.count_active_hypervisors() + def count_active_hypervisors(self): """Count all hypervisors which are up.""" compute_cnt = 0 for hypervisor in self.orig_cloud.list_hypervisors(): if hypervisor['state'] == 'up': compute_cnt += 1 + else: + self.__logger.warning( + "%s is down", hypervisor['hypervisor_hostname']) return compute_cnt def run(self, **kwargs): -- cgit 1.2.3-korg