From 6eaeb1b9954f1065ce1075ec1d95faf8f60a02c7 Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Mon, 4 Jul 2022 18:22:16 +0200 Subject: [PATCH] Fix overcloud_health_checks on OSP17 This patch fixes several issues affecting OSP17 when faults/ha tests are executed: 1) nova_libvirt container is renamed to nova_virtqemud 2) ovn_l3_mode is deprecated from neutron configuration 3) ovn dbs resources status names changes from Master/Slave to Promoted/Unpromoted Change-Id: I21237ff96f766fb9e36a4f7cbe458343c1dcf15a --- tobiko/openstack/topology/_topology.py | 4 ++++ tobiko/tripleo/containers.py | 13 +++++++++---- tobiko/tripleo/nova.py | 3 ++- tobiko/tripleo/pacemaker.py | 27 +++++++++++++++++--------- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/tobiko/openstack/topology/_topology.py b/tobiko/openstack/topology/_topology.py index 5e9891e3d..45e22712a 100644 --- a/tobiko/openstack/topology/_topology.py +++ b/tobiko/openstack/topology/_topology.py @@ -15,6 +15,7 @@ from __future__ import absolute_import import collections from collections import abc +import functools import re import typing from urllib import parse @@ -648,6 +649,9 @@ def get_nova_version_from_container(): pass +# During a execution of tobiko, openstack version does not change, so let's +# cache the output of this function +@functools.lru_cache() def get_openstack_version(): try: return get_rhosp_version() diff --git a/tobiko/tripleo/containers.py b/tobiko/tripleo/containers.py index a89a0a766..aa624b776 100644 --- a/tobiko/tripleo/containers.py +++ b/tobiko/tripleo/containers.py @@ -263,10 +263,18 @@ def assert_containers_running(group, expected_containers, full_name=True, return True +def get_libvirt_container_name(): + if topology.verify_osp_version('17.0', lower=True): + return 'nova_libvirt' + else: + return 'nova_virtqemud' + + def assert_all_tripleo_containers_running(): """check that all common tripleo containers are running param: group controller or compute , check containers sets in computes or controllers""" + nova_libvirt = get_libvirt_container_name() common_controller_tripleo_containers = ['cinder_api', 'cinder_api_cron', 'cinder_scheduler', @@ -313,7 +321,7 @@ def assert_all_tripleo_containers_running(): 'nova_vnc_proxy'] common_compute_tripleo_containers = ['iscsid', 'logrotate_crond', - 'nova_compute', 'nova_libvirt', + 'nova_compute', nova_libvirt, 'nova_migration_target', 'nova_virtlogd'] @@ -391,9 +399,6 @@ def run_container_config_validations(): {'section': 'ml2', 'param': 'type_drivers', 'expected_value': 'geneve'}, - {'section': 'ovn', - 'param': 'ovn_l3_mode', - 'expected_value': 'True'}, {'section': 'ovn', 'param': 'ovn_metadata_enabled', 'expected_value': 'True'}]}] diff --git a/tobiko/tripleo/nova.py b/tobiko/tripleo/nova.py index c31e5f9c0..99bff390c 100644 --- a/tobiko/tripleo/nova.py +++ b/tobiko/tripleo/nova.py @@ -199,7 +199,8 @@ def check_vm_running_via_virsh(topology_compute, vm_id): def get_vm_uuid_list_running_via_virsh(topology_compute): if overcloud.has_overcloud(): container_runtime = containers.get_container_runtime_name() - command = f"sudo {container_runtime} exec nova_libvirt " \ + nova_libvirt = containers.get_libvirt_container_name() + command = f"sudo {container_runtime} exec {nova_libvirt} " \ f"sh -c 'for i in `virsh list --name --state-running` " \ f";do virsh domuuid $i;done'" else: diff --git a/tobiko/tripleo/pacemaker.py b/tobiko/tripleo/pacemaker.py index 8e6dcf719..b6c3a91bc 100644 --- a/tobiko/tripleo/pacemaker.py +++ b/tobiko/tripleo/pacemaker.py @@ -78,20 +78,27 @@ def get_pcs_resources_table(timeout=720, interval=2) -> pandas.DataFrame: return table +def get_pcs_prefix_and_status_values(): + if topology.verify_osp_version('17.0', lower=True): + ocf_prefix = "ocf::" + promoted_status_str = "Master" + unpromoted_status_str = "Slave" + else: + ocf_prefix = "ocf:" + promoted_status_str = "Promoted" + unpromoted_status_str = "Unpromoted" + return ocf_prefix, promoted_status_str, unpromoted_status_str + + class PacemakerResourcesStatus(object): """ class to handle pcs resources checks """ def __init__(self): self.pcs_df = get_pcs_resources_table() - if topology.verify_osp_version('17.0', lower=True): - self.ocf_prefix = "ocf::" - self.promoted_status_str = "Master" - self.unpromoted_status_str = "Slave" - else: - self.ocf_prefix = "ocf:" - self.promoted_status_str = "Promoted" - self.unpromoted_status_str = "Unpromoted" + (self.ocf_prefix, + self.promoted_status_str, + self.unpromoted_status_str) = get_pcs_prefix_and_status_values() def container_runtime(self): @@ -280,8 +287,10 @@ def get_resource_master_node(resource_type=None): def get_ovn_db_master_node(): + ocf_prefix, promoted_status_str, _ = get_pcs_prefix_and_status_values() return get_overcloud_nodes_running_pcs_resource( - resource_type='(ocf::ovn:ovndb-servers):', resource_state='Master') + resource_type=f'({ocf_prefix}ovn:ovndb-servers):', + resource_state=promoted_status_str) def get_overcloud_resource(resource_type=None,