Add option to add NAT networks to overcloud nodes

Jinja template for overcloud VMs is currently configured to skip
adding network to VM's definition if forward_mode: 'nat' is set
for this network. As a result, libvirt networks with enabled NAT
forwarding mode could not be used by overcloud nodes for external
connectivity.

It is not a problem for single-nic scenarios: director node is
used to connect overcloud nodes to external networks. But this
limitation makes it hard to create infrastructure for overcloud
deployments with multiple NICs and network isolation.

This patch adds flexibility by allowing users to force adding
network connections to overcloud VMs even if forward_mode: 'nat'
is set for this network. This patch doesn't change current
behavior if force_ovc parameter is not defined for any network.

Change-Id: Ibd2e40878b8fd4b1e4db7f654c251b4968da8b85
Partial-Bug: #1666916
This commit is contained in:
Alexey Stupnikov 2020-10-28 16:43:49 +01:00
parent 69fcd743b7
commit a8ff5de91c
2 changed files with 5 additions and 1 deletions

View File

@ -137,6 +137,8 @@ overcloud_nodes:
# network will be attached to the undercloud. This is required to ssh from the
# virt host to the undercloud
# * The first bridge network defined will be used for pxe booting
# * Networks with forward_mode: 'nat' will not be attached to overcloud
# nodes unless force_ovc: true is used in network's definition.
#
external_network_cidr: 192.168.23.0/24
networks:
@ -146,6 +148,7 @@ networks:
- name: external
bridge: brext
forward_mode: nat
force_ovc: false
address: "{{ external_network_cidr|nthhost(1) }}"
netmask: "{{ external_network_cidr|ipaddr('netmask') }}"
dhcp_range:

View File

@ -27,7 +27,8 @@
<target dev='{{ libvirt_diskdev }}' bus='{{ libvirt_diskbus }}'/>
</disk>
{% for network in networks %}
{% if (network.forward_mode is not defined) or (network.forward_mode is defined and network.forward_mode != 'nat') %}
{% if ( (network.force_ovc|default(false)|bool) or (network.forward_mode is not defined) or
(network.forward_mode is defined and network.forward_mode != 'nat') ) %}
<interface type='bridge'>
<mac address='{{ node_mac_map.get(item.name).get(network.name) }}'/>
<source bridge='{{ network.bridge }}'/>