ovn-migration: Use DHCP nodes to configure dnsmasq

Previously, the migration script used controller nodes to configure
dnsmasq when configuring new MTU. Controller nodes may not run DHCP
agents. The patch detects DHCP agents instead and uses those to
configure dnsmasq.

Closes-bug: #1928450

Change-Id: Ib468c04779af7aaf4dedf84ba885bce71078248b
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
(cherry picked from commit 569aa4452a)
This commit is contained in:
Jakub Libosvar 2021-03-19 12:07:12 +01:00
parent 3e7f78c62a
commit 208fea3bf6
1 changed files with 12 additions and 1 deletions

View File

@ -126,6 +126,8 @@ EOF
# Generate the inventory file for ansible migration playbook. # Generate the inventory file for ansible migration playbook.
generate_ansible_inventory_file() { generate_ansible_inventory_file() {
local dhcp_nodes
echo "Generating the inventory file for ansible-playbook" echo "Generating the inventory file for ansible-playbook"
source $STACKRC_FILE source $STACKRC_FILE
echo "[ovn-dbs]" > hosts_for_migration echo "[ovn-dbs]" > hosts_for_migration
@ -153,13 +155,22 @@ generate_ansible_inventory_file() {
node_ip=$(get_host_ip "$inventory_file" $node_name) node_ip=$(get_host_ip "$inventory_file" $node_name)
echo $node_name ansible_host=$node_ip ansible_ssh_user=$UNDERCLOUD_NODE_USER ansible_become=true ovn_controller=true >> hosts_for_migration echo $node_name ansible_host=$node_ip ansible_ssh_user=$UNDERCLOUD_NODE_USER ansible_become=true ovn_controller=true >> hosts_for_migration
done done
echo "" >> hosts_for_migration
echo "[dhcp]" >> hosts_for_migration
dhcp_nodes=$(get_group_hosts "$inventory_file" neutron_dhcp)
for node_name in $dhcp_nodes; do
node_ip=$(get_host_ip "$inventory_file" $node_name)
echo $node_name ansible_host=$node_ip ansible_ssh_user=$UNDERCLOUD_NODE_USER ansible_become=true >> hosts_for_migration
done
rm -f "$inventory_file" rm -f "$inventory_file"
echo "" >> hosts_for_migration echo "" >> hosts_for_migration
cat >> hosts_for_migration << EOF cat >> hosts_for_migration << EOF
[overcloud-controllers:children] [overcloud-controllers:children]
ovn-dbs dhcp
[overcloud:children] [overcloud:children]
ovn-controllers ovn-controllers