Configure network for multiple-nics-vlans

Currently network config for external network
is not handled when deploying overcloud with
multiple-nics-vlans network_isolation.

This patch handles this case and configures the vlan
on external interface on the undercloud.

Change-Id: I82013d33c1729619e47b633bddd1580e9efe0b55
This commit is contained in:
yatinkarel 2021-12-24 18:13:15 +05:30
parent 31a0957f4c
commit 859f2ec917
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,5 @@
---
external_interface: eth2
overcloud_prep_network_script: overcloud-prep-network.sh.j2
overcloud_prep_network_log: "{{ working_dir }}/overcloud_prep_network.log"

View File

@ -53,7 +53,7 @@ fi
sudo sh -c 'iptables-save > /etc/sysconfig/iptables'
{% endif %}
{% if network_isolation|bool and network_isolation_type in ['single-nic-vlans', 'single_nic_vlans', 'bond-with-vlans', 'bond_with_vlans'] %}
{% if network_isolation|bool and network_isolation_type in ['single-nic-vlans', 'single_nic_vlans', 'bond-with-vlans', 'bond_with_vlans', 'multiple-nics-vlans'] %}
{% if network_isolation_type in ['single_nic_vlans', 'bond_with_vlans'] %}
# NOTE: 'bond_with_vlans' and 'single_nic_vlans' are deprecated
@ -64,15 +64,20 @@ echo "Please use 'single-nic-vlans' and 'bond-with-vlans'"
{% if not overcloud_ipv6|bool and network.device_type is defined and network.device_type == 'ovs' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-vlan{{ network.tag }}
DEVICE=vlan{{ network.tag }}
ONBOOT=yes
DEVICETYPE={{ network.device_type }}
TYPE={{ network.type }}
BOOTPROTO=static
IPADDR={{ network.address }}
NETMASK={{ network.netmask }}
{% if network_isolation_type == 'multiple-nics-vlans' %}
DEVICE={{ external_interface }}.{{ network.tag }}
VLAN=yes
{% else %}
DEVICE=vlan{{ network.tag }}
DEVICETYPE={{ network.device_type }}
TYPE={{ network.type }}
OVS_BRIDGE={{ network.ovs_bridge }}
OVS_OPTIONS={{ network.ovs_options }}
{% endif %}
EOF'
sudo ifup ifcfg-vlan{{ network.tag }}