Merge "Skip background ping checks during controllers reboot with nonDVR"

This commit is contained in:
Zuul 2023-09-29 14:53:34 +00:00 committed by Gerrit Code Review
commit 6009ff1e79
4 changed files with 35 additions and 2 deletions

View File

@ -165,7 +165,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
def test_0vercloud_health_check(self): def test_0vercloud_health_check(self):
OvercloudHealthCheck.run_before(skip_mac_table_size_test=False) OvercloudHealthCheck.run_before(skip_mac_table_size_test=False)
@nova.skip_background_vm_ping_checks @nova.skip_background_vm_ping_checks_when_nondvr
def test_z99_hard_reboot_controllers_recovery(self): def test_z99_hard_reboot_controllers_recovery(self):
OvercloudHealthCheck.run_before() OvercloudHealthCheck.run_before()
cloud_disruptions.reset_all_controller_nodes() cloud_disruptions.reset_all_controller_nodes()
@ -215,6 +215,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
except nova_osp.ServerNotFoundError: except nova_osp.ServerNotFoundError:
LOG.debug(f"Server {vm_id} not found") LOG.debug(f"Server {vm_id} not found")
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_galera_main_vip(self): def test_z99_reboot_controller_galera_main_vip(self):
# This test case may fail at times if RHBZ#2124877 is not resolved # This test case may fail at times if RHBZ#2124877 is not resolved
@ -231,24 +232,28 @@ class DisruptTripleoNodesTest(testtools.TestCase):
cloud_disruptions.check_no_duplicate_ips( cloud_disruptions.check_no_duplicate_ips(
self.vms_detailed_info, ports_before_stack_creation) self.vms_detailed_info, ports_before_stack_creation)
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_main_vip(self): def test_z99_reboot_controller_main_vip(self):
OvercloudHealthCheck.run_before() OvercloudHealthCheck.run_before()
cloud_disruptions.reset_controller_main_vip() cloud_disruptions.reset_controller_main_vip()
OvercloudHealthCheck.run_after() OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_non_main_vip(self): def test_z99_reboot_controller_non_main_vip(self):
OvercloudHealthCheck.run_before() OvercloudHealthCheck.run_before()
cloud_disruptions.reset_controllers_non_main_vip() cloud_disruptions.reset_controllers_non_main_vip()
OvercloudHealthCheck.run_after() OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_crash_controller_main_vip(self): def test_z99_crash_controller_main_vip(self):
OvercloudHealthCheck.run_before() OvercloudHealthCheck.run_before()
cloud_disruptions.crash_controller_main_vip() cloud_disruptions.crash_controller_main_vip()
OvercloudHealthCheck.run_after() OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@overcloud.skip_unless_kexec_tools_installed @overcloud.skip_unless_kexec_tools_installed
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_crash_controller_non_main_vip(self): def test_z99_crash_controller_non_main_vip(self):
@ -256,6 +261,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
cloud_disruptions.crash_controllers_non_main_vip() cloud_disruptions.crash_controllers_non_main_vip()
OvercloudHealthCheck.run_after() OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@pacemaker.skip_if_fencing_not_deployed @pacemaker.skip_if_fencing_not_deployed
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB) @testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_network_disruptor_main_vip(self): def test_network_disruptor_main_vip(self):
@ -317,6 +323,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
cloud_disruptions.request_galera_sst() cloud_disruptions.request_galera_sst()
OvercloudHealthCheck.run_after() OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@pytest.mark.flaky(reruns=0) @pytest.mark.flaky(reruns=0)
def test_controllers_shutdown(self): def test_controllers_shutdown(self):
OvercloudHealthCheck.run_before() OvercloudHealthCheck.run_before()

View File

@ -54,6 +54,7 @@ skip_if_missing_overcloud = overcloud.skip_if_missing_overcloud
skip_unless_has_overcloud = overcloud.skip_unless_has_overcloud skip_unless_has_overcloud = overcloud.skip_unless_has_overcloud
get_overcloud_ssh_username = overcloud.get_overcloud_ssh_username get_overcloud_ssh_username = overcloud.get_overcloud_ssh_username
skip_if_ceph_rgw = containers.skip_if_ceph_rgw skip_if_ceph_rgw = containers.skip_if_ceph_rgw
get_container_runtime_name = containers.get_container_runtime_name
get_rhosp_release = _rhosp.get_rhosp_release get_rhosp_release = _rhosp.get_rhosp_release
get_rhosp_version = _rhosp.get_rhosp_version get_rhosp_version = _rhosp.get_rhosp_version

View File

@ -445,3 +445,15 @@ def setup_overcloud_keystone_credentials():
keystone.register_default_keystone_credentials( keystone.register_default_keystone_credentials(
credentials=overcloud_keystone_credentials(), credentials=overcloud_keystone_credentials(),
position=0) position=0)
@functools.lru_cache()
def is_dvr_enabled():
controller0 = topology.list_openstack_nodes(group='controller')[0]
container_runtime = tripleo.get_container_runtime_name()
command = (f"{container_runtime} exec neutron_api crudini --get "
"/etc/neutron/neutron.conf DEFAULT enable_dvr")
enable_dvr = sh.execute(command,
ssh_client=controller0.ssh_client,
sudo=True).stdout.lower()
return "true" in enable_dvr

View File

@ -268,7 +268,20 @@ def skip_background_vm_ping_checks(func):
must be dropped for the duration of the test - func""" must be dropped for the duration of the test - func"""
@wraps(func) @wraps(func)
def wrapper(*args): # pylint: disable=W0613 def wrapper(*args): # pylint: disable=W0613
tobiko.add_cleanup(skip_check_or_start_background_vm_ping)
check_or_start_background_vm_ping() check_or_start_background_vm_ping()
func(*args) func(*args)
skip_check_or_start_background_vm_ping() return wrapper
def skip_background_vm_ping_checks_when_nondvr(func):
"""Similar to skip_background_vm_ping_checks, but the background ping
checks and the restart of the background ping process is only executed when
DVR is disabled"""
@wraps(func)
def wrapper(*args): # pylint: disable=W0613
if not overcloud.is_dvr_enabled():
tobiko.add_cleanup(skip_check_or_start_background_vm_ping)
check_or_start_background_vm_ping()
func(*args)
return wrapper return wrapper