Fix is_controller value assignment for podified

On podified environment it can be that more than one replica
of rabbit or galera is running on same node and some other
OCP node does not have such processes running while still being
OSP controller, i.e. host with OSP control plane services.
This patch assigns is_controller flag for OCP hosts according
to inventory data.

Change-Id: I5aa66350f6eca924c756f82b3c074136c3388f9e
This commit is contained in:
Roman Safronov 2024-07-25 17:57:06 +03:00
parent 1067fef73a
commit 643e1ed4b2

View File

@ -226,6 +226,8 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
return host
def append_node_data(node, is_crc):
# Here we mean ansible controller node used by the ci-framework
# This controller is not a part of OSP and should be skipped
if 'controller' in node:
return
if 'ocp' in node and not is_crc:
@ -238,13 +240,17 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
'~', '/home/{}'.format(WB_CONF.proxy_host_user)))
node_key = hosts_data[node][key].split('/')[-1]
node_ip = get_ocp_main_ip(hosts_data[node]['ansible_host'])
is_controller = True
else:
node_key = 'id_cifw_key'
node_ip = hosts_data[node]['ansible_host']
# Here we mean a node with running OSP control plane services
is_controller = ('ocp' in node)
node_data = {
'ip': node_ip,
'user': hosts_data[node]['ansible_user'],
'key': node_key}
'key': node_key,
'is_controller': is_controller}
nodes.append(node_data)
nodes = []
@ -325,13 +331,14 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
host['client'].exec_command('hostname').strip())
host['full_name'] = cls.get_full_name(
host['client'].exec_command('hostname -f').strip())
# Here we are checking if there are controller-specific
# processes running on the node
output = host['client'].exec_command(
r"ps ax | grep 'rabbit\|galera' | grep -v grep || true")
host['is_controller'] = (output.strip() != "")
host['is_compute'] = (host['full_name'] in compute_hosts)
host['is_networker'] = (host['full_name'] in l3_agent_hosts)
if WB_CONF.openstack_type == 'devstack':
# Here we are checking if there are controller-specific
# processes running on the node
output = host['client'].exec_command(
r"ps ax | grep 'rabbit\|galera' | grep -v grep || true")
host['is_controller'] = (output.strip() != "")
cls.nodes.append(host)
@classmethod