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 <cedric.ollivier@orange.com>
(cherry picked from commit
7332716dc835cd72b0beefc38afda2697bd99e02)
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):
shutil.copytree(task_macro, macro_dir)
self.update_keystone_default_role()
- self.compute_cnt = self.count_active_hypervisors()
+ self.compute_cnt = self.count_hypervisors()
self.network_extensions = self.cloud.get_network_extensions()
self.flavor_alt = self.create_flavor_alt()
self.services = [service.name for service in
self.role = None
def check_requirements(self):
- if self.count_active_hypervisors() < 2:
+ if self.count_hypervisors() < 2:
self.__logger.warning("Shaker requires at least 2 hypervisors")
self.is_skipped = True
self.project.clean()
self.deployment_dir = self.get_verifier_deployment_dir(
self.verifier_id, self.deployment_id)
- compute_cnt = self.count_active_hypervisors()
+ compute_cnt = self.count_hypervisors()
self.image_alt = self.publish_image_alt()
self.flavor_alt = self.create_flavor_alt()
LOGGER.debug("flavor: %s", self.flavor_alt)
(_, self.pubkey_filename) = tempfile.mkstemp()
def check_requirements(self):
- if self.count_active_hypervisors() < 2:
+ if self.count_hypervisors() < 2:
self.__logger.warning("Vmtp requires at least 2 hypervisors")
self.is_skipped = True
self.project.clean()
def test_prepare_run_flavor_alt_creation_failed(self, *args):
# pylint: disable=unused-argument
self.rally_base.stests = ['test1', 'test2']
- with mock.patch.object(self.rally_base, 'count_active_hypervisors') \
+ with mock.patch.object(self.rally_base, 'count_hypervisors') \
as mock_list_hyperv, \
mock.patch.object(self.rally_base, 'create_flavor_alt',
side_effect=Exception) \
'NEW_USER_ROLE': 'Member',
'USE_DYNAMIC_CREDENTIALS': 'True',
'BLOCK_MIGRATION': 'True',
- 'CLEAN_ORPHAN_SECURITY_GROUPS': 'True'
+ 'CLEAN_ORPHAN_SECURITY_GROUPS': 'True',
+ 'SKIP_DOWN_HYPERVISORS': 'False'
}