Skip background ping checks during controllers reboot with nonDVR

When DVR is disabled, rebooting or applying network disruptions on the
controllers nodes can affect dataplane traffic because the packets are
not directly routed to the compute nodes.
Due to this, some faults tests fail during the background ping checks.
This patch skips the background ping checks on those tests.

Change-Id: If51016ce7c3562d1f18ac1f2124db72ef29c90d7
This commit is contained in:
Eduardo Olivares 2023-09-22 15:58:39 +02:00
parent 715d6c9361
commit 7cbf30b983
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):
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):
OvercloudHealthCheck.run_before()
cloud_disruptions.reset_all_controller_nodes()
@ -215,6 +215,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
except nova_osp.ServerNotFoundError:
LOG.debug(f"Server {vm_id} not found")
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_galera_main_vip(self):
# 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(
self.vms_detailed_info, ports_before_stack_creation)
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_main_vip(self):
OvercloudHealthCheck.run_before()
cloud_disruptions.reset_controller_main_vip()
OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_reboot_controller_non_main_vip(self):
OvercloudHealthCheck.run_before()
cloud_disruptions.reset_controllers_non_main_vip()
OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_crash_controller_main_vip(self):
OvercloudHealthCheck.run_before()
cloud_disruptions.crash_controller_main_vip()
OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@overcloud.skip_unless_kexec_tools_installed
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_z99_crash_controller_non_main_vip(self):
@ -256,6 +261,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
cloud_disruptions.crash_controllers_non_main_vip()
OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@pacemaker.skip_if_fencing_not_deployed
@testtools.skipIf(has_external_lb, SKIP_MESSAGE_EXTLB)
def test_network_disruptor_main_vip(self):
@ -317,6 +323,7 @@ class DisruptTripleoNodesTest(testtools.TestCase):
cloud_disruptions.request_galera_sst()
OvercloudHealthCheck.run_after()
@nova.skip_background_vm_ping_checks_when_nondvr
@pytest.mark.flaky(reruns=0)
def test_controllers_shutdown(self):
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
get_overcloud_ssh_username = overcloud.get_overcloud_ssh_username
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_version = _rhosp.get_rhosp_version

View File

@ -445,3 +445,15 @@ def setup_overcloud_keystone_credentials():
keystone.register_default_keystone_credentials(
credentials=overcloud_keystone_credentials(),
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"""
@wraps(func)
def wrapper(*args): # pylint: disable=W0613
tobiko.add_cleanup(skip_check_or_start_background_vm_ping)
check_or_start_background_vm_ping()
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