From 859f2ec917784fdb21d11b9e2d13cebb61730c05 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Fri, 24 Dec 2021 18:13:15 +0530 Subject: [PATCH] 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 --- roles/overcloud-prep-network/defaults/main.yml | 1 + .../templates/overcloud-prep-network.sh.j2 | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/overcloud-prep-network/defaults/main.yml b/roles/overcloud-prep-network/defaults/main.yml index fcb8034da..442ec4c93 100644 --- a/roles/overcloud-prep-network/defaults/main.yml +++ b/roles/overcloud-prep-network/defaults/main.yml @@ -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" diff --git a/roles/overcloud-prep-network/templates/overcloud-prep-network.sh.j2 b/roles/overcloud-prep-network/templates/overcloud-prep-network.sh.j2 index 71d3d81d9..fa9bcf1f5 100644 --- a/roles/overcloud-prep-network/templates/overcloud-prep-network.sh.j2 +++ b/roles/overcloud-prep-network/templates/overcloud-prep-network.sh.j2 @@ -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 < /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 }}