From 1f5bede73d99f89a3cf1ec5fae7b30cee454b6c8 Mon Sep 17 00:00:00 2001
From: Tim Rozet <trozet@redhat.com>
Date: Fri, 15 Jul 2016 22:04:24 -0400
Subject: Allows specifying nic order for overcloud nodes in network settings

Currently there is no way to specify logically or physically the nic
order to be used on overcloud nodes.  We always hardcode to use nic1 for
admin network, nic2 for private, etc.  This patch allows a user to not
only decide which logical nics to use for which network, but also
specify physical interface names if they need to.

This is done on a per role basis, due to tripleO limitation.  So a user
is able to specify nic order/names for compute and controller roles
separately.

If a user specifies nic order, they must specify it for all networks
other than admin network.  We assume if admin network is unspecified it
uses "nic1", so that name is reserved in this case.  A user is also
allowed to specify a mixture of logical and physical names, for example
"nic2" and "eth3" on another network.

JIRA: APEX-151

Change-Id: Ie9d4abb463cf8f8788913cb4bcf9486830adc449
Signed-off-by: Tim Rozet <trozet@redhat.com>
---
 build/nics-template.yaml.jinja2 | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

(limited to 'build')

diff --git a/build/nics-template.yaml.jinja2 b/build/nics-template.yaml.jinja2
index 91d0c478..53290e4f 100644
--- a/build/nics-template.yaml.jinja2
+++ b/build/nics-template.yaml.jinja2
@@ -91,7 +91,7 @@ resources:
               members:
                 -
                   type: interface
-                  name: nic1
+                  name: {{ nics[role]['admin_network'] }}
                   # force the MAC address of the bridge to this interface
                   primary: true
                 {%- if 'public_network' in enabled_networks and vlans['public_network'] is number %}
@@ -132,7 +132,7 @@ resources:
                 {%- endif %}
             {%- else %}
               type: interface
-              name: nic1
+              name: {{ nics[role]['admin_network'] }}
             {%- endif %}
               use_dhcp: false
               dns_servers: {get_param: DnsServers}
@@ -153,7 +153,6 @@ resources:
                   next_hop: {get_param: ControlPlaneDefaultRoute}
                 {%- endif %}
 
-            {%- set nic_index = 2 %}
             {%- if 'private_network' in enabled_networks and vlans['private_network'] == 'native' %}
             {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
             -
@@ -166,7 +165,7 @@ resources:
               members:
                 -
                   type: interface
-                  name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+                  name: {{ nics[role]['private_network'] }}
                   # force the MAC address of the bridge to this interface
                   primary: true
             -
@@ -176,7 +175,7 @@ resources:
             {%- else %}
             -
               type: interface
-              name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+              name: {{ nics[role]['private_network'] }}
               use_dhcp: false
               addresses:
                 -
@@ -186,7 +185,7 @@ resources:
             {%- if 'public_network' in enabled_networks and external_net_type == 'interface' and vlans['public_network'] == 'native' %}
             -
               type: interface
-              name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+              name: {{ nics[role]['public_network'] }}
               {%- if role == 'controller' %}
               dns_servers: {get_param: DnsServers}
               {%- endif %}
@@ -209,7 +208,7 @@ resources:
               members:
                 -
                   type: interface
-                  name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+                  name: {{ nics[role]['public_network'] }}
                   # force the MAC address of the bridge to this interface
                   primary: true
               {%- if role == 'controller' %}
@@ -227,7 +226,7 @@ resources:
             {%- if 'storage_network' in enabled_networks and vlans['storage_network'] == 'native' %}
             -
               type: interface
-              name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+              name: {{ nics[role]['storage_network'] }}
               use_dhcp: false
               addresses:
                 -
@@ -236,7 +235,7 @@ resources:
             {%- if 'api_network' in enabled_networks and vlans['api_network'] == 'native' %}
             -
               type: interface
-              name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
+              name: {{ nics[role]['api_network'] }}
               use_dhcp: false
               addresses:
                 -
-- 
cgit