Make the reset_all_controller_nodes() method work with a composable control plane

In a composable control plane we have three sets of nodes hosting APIs and their
underlying services: controller, messaging, networker and database.

Let's make sure that we take this into consideration when trying to reset the
whole control plane.


Co-Authored-By: Luca Miccini <lmiccini@redhat.com>
Change-Id: I789fcf0b638804dad74484e8b5f842965eac055f
This commit is contained in:
Michele Baldessari 2020-04-09 15:23:54 +02:00 committed by Pini Komarov
parent 608ceab04b
commit 5319b0ac9e
2 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from __future__ import absolute_import
import tobiko
from tobiko.shell import sh
from tobiko.openstack import topology
from tobiko.tripleo import topology as tripleo_topology
from oslo_log import log
@ -19,7 +20,10 @@ def reset_all_controller_nodes(hard_reset=False):
'sudo echo b > /proc/sysrq-trigger'
else:
reset_method = 'sudo reboot'
nodes = topology.list_openstack_nodes(group='controller')
controlplane_groups = ['controller', 'messaging', 'database', 'networker']
actual_controlplane_groups = tripleo_topology.actual_node_groups(
controlplane_groups)
nodes = topology.list_openstack_nodes(group=actual_controlplane_groups)
for controller in nodes:
# using ssh_client.connect we use a fire and forget reboot method
controller.ssh_client.connect().exec_command(reset_method)

View File

@ -85,3 +85,8 @@ def str_is_not_ip(check_str):
def ip_to_hostname(oc_ip):
return get_ip_to_nodes_dict()[oc_ip]
def actual_node_groups(groups):
"""return only existing node groups"""
return set(groups).intersection(topology.list_openstack_node_groups())