Refactor the underlay.ssh update process for VCP minions
fuel-devops node names in the underlay.yaml can be
different from actual hostnames configured on hosts:
underlay.yaml: ctl01
hostname -f: ctl01.cookied-cicd-k8s-calico.local
Shorter names are connected to qemu limitation for
monitor.lock path and how the fuel-devops creates
unique names for the environment nodes.
1. To not double the same nodes in the underlay.ssh, match
the VCP nodes to underlay.ssh nodes not by name, but by
IP address and address_pool.
Add new method update_ssh_data_from_minions() to
SaltManager with this functional.
2. Add new attribute to underlay.ssh: minion_id , which will
provide mapping from underlay.ssh to the minion_id for the
nodes.
3. Add helper method host_by_minion_id() to UnderlayManager
to get host IP by minion_id
Change-Id: I510d9a777df8f308c1a7fede7b4ec2feb314c5bd
diff --git a/tcp_tests/fixtures/k8s_fixtures.py b/tcp_tests/fixtures/k8s_fixtures.py
index e581b86..50c69ee 100644
--- a/tcp_tests/fixtures/k8s_fixtures.py
+++ b/tcp_tests/fixtures/k8s_fixtures.py
@@ -77,16 +77,16 @@
interfaces_pillar = k8s_actions._salt.get_pillar(
tgt=tgt, pillar='linux:network:interface')[0]
- for node_name, interfaces in interfaces_pillar.items():
+ for minion_id, interfaces in interfaces_pillar.items():
for iface_name, iface in interfaces.items():
iface_name = iface.get('name', iface_name)
default_proto = 'static' if 'address' in iface else 'dhcp'
if iface.get('proto', default_proto) != 'dhcp':
LOG.warning('Trying to kill dhclient for iface {0} '
- 'on node {1}'.format(iface_name, node_name))
+ 'on node {1}'.format(iface_name, minion_id))
underlay.check_call(
cmd='pkill -f "dhclient.*{}"'.format(iface_name),
- node_name=node_name, raise_on_err=False)
+ node_name=minion_id, raise_on_err=False)
LOG.warning('Restarting keepalived service on controllers...')
k8s_actions._salt.local(tgt='ctl*', fun='cmd.run',
diff --git a/tcp_tests/fixtures/salt_fixtures.py b/tcp_tests/fixtures/salt_fixtures.py
index 7f4ce60..226ab22 100644
--- a/tcp_tests/fixtures/salt_fixtures.py
+++ b/tcp_tests/fixtures/salt_fixtures.py
@@ -71,13 +71,7 @@
LOG.info("############ Executing command ####### {0}".format(commands))
salt_actions.install(commands)
- salt_nodes = salt_actions.get_ssh_data()
- config.underlay.ssh = config.underlay.ssh + \
- [node for node in salt_nodes
- if not any(node['node_name'] == n['node_name']
- for n in config.underlay.ssh)]
- underlay.config_ssh = []
- underlay.add_config_ssh(config.underlay.ssh)
+ salt_actions.update_ssh_data_from_minions()
hardware.create_snapshot(ext.SNAPSHOT.salt_deployed)
salt_actions.sync_time()