update the network design to make support easier and cleaner
Change-Id: Iddf25266e3fd534ba88887acb7116faa04224c39
(cherry picked from commit c15f8e1231905cb83e0db014b8c1b3d7c72b23f0)
diff --git a/roles/compute-node/files/pull-latest-docker-images b/roles/compute-node/files/pull-latest-docker-images
new file mode 100755
index 0000000..abcdf02
--- /dev/null
+++ b/roles/compute-node/files/pull-latest-docker-images
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+for i in $(docker images --format '{{.Repository}}:{{.Tag}}' | grep docker-registry | grep -v "<none>" | sort); do
+ docker pull $i
+done
diff --git a/roles/compute-node/files/rename_ifaces.sh b/roles/compute-node/files/rename_ifaces.sh
index b355579..a490717 100755
--- a/roles/compute-node/files/rename_ifaces.sh
+++ b/roles/compute-node/files/rename_ifaces.sh
@@ -132,10 +132,10 @@
for i in $(cat $2); do
if [ "eth$IDX" == "$4" ]; then
echo "auto eth$IDX" >> $OUT
- if [ "$EXT_IP" == "dhcp" ]; then
+ if [ "$EXT_ADDR" == "dhcp" ]; then
echo "iface eth$IDX inet dhcp" >> $OUT
- elif [ "$EXT_IP" == "manual" ]; then
- echo "iface eth$IDX inet manual" >> $OUT
+ elif [ "$EXT_ADDR" == "manual" ]; then
+ echo "iface eth$IDX inet manual" >> $OUT
else
echo "iface eth$IDX inet static" >> $OUT
echo " address $EXT_IP" >> $OUT
@@ -143,22 +143,8 @@
echo " netmask $EXT_NETMASK" >> $OUT
echo " broadcast $EXT_BROADCAST" >> $OUT
echo " gateway $EXT_GW" >> $OUT
- echo " dns-nameservers 8.8.8.8 8.8.4.4" >> $OUT
- echo " dns-search cord.lab" >> $OUT
- fi
- elif [ "eth$IDX" == "$5" ]; then
- echo "auto eth$IDX" >> $OUT
- if [ "$MGT_IP" == "dhcp" ]; then
- echo "iface eth$IDX inet dhcp" >> $OUT
- elif [ "$MGT_IP" == "manual" ]; then
- echo "iface eth$IDX inet manual" >> $OUT
- else
- echo "iface eth$IDX inet static" >> $OUT
- echo " address $MGT_IP" >> $OUT
- echo " network $MGT_NETWORK" >> $OUT
- echo " netmask $MGT_NETMASK" >> $OUT
- echo " broadcast $MGT_BROADCAST" >> $OUT
- echo " gateway $MGT_GW" >> $OUT
+ echo " dns-nameservers 8.8.8.8 8.8.4.4" >> $OUT
+ echo " dns-search cord.lab" >> $OUT
fi
else
echo "auto eth$IDX" >> $OUT
@@ -172,12 +158,23 @@
local BRNAME=$5
local F=$(echo $5 | grep "^eth[0-9]*$" | wc -l)
if [ $F -ne 0 ]; then
- BRNAME="br-mgmt"
+ BRNAME="mgmtbr"
fi
local BPCNT=$(echo $BRIDGE_PORTS | wc -w)
if [ $BPCNT -ne 0 ]; then
echo "auto $BRNAME" >> $OUT
- echo "iface $BRNAME inet dhcp" >> $OUT
+ if [ "$MGT_ADDR" == "dhcp" ]; then
+ echo "iface $BRNAME inet dhcp" >> $OUT
+ elif [ "$MGT_ADDR" == "manual" ]; then
+ echo "iface $BRNAME inet manual" >> $OUT
+ else
+ echo "iface $BRNAME inet static" >> $OUT
+ echo " address $MGT_IP" >> $OUT
+ echo " network $MGT_NETWORK" >> $OUT
+ echo " netmask $MGT_NETMASK" >> $OUT
+ echo " broadcast $MGT_BROADCAST" >> $OUT
+ echo " gateway $MGT_GW" >> $OUT
+ fi
echo " bridge_ports $BRIDGE_PORTS" >> $OUT
fi
}
@@ -191,23 +188,25 @@
EXT_IFACE=$3
EXT_ADDR=$4
+EXT_GW=$5
if [ "$EXT_ADDR" != "dhcp" ]; then
EXT_IP=$(echo $EXT_ADDR | cut -d/ -f1)
EXT_MASKBITS=$(echo $EXT_ADDR | cut -d/ -f2)
EXT_NETWORK=$(network $EXT_IP $EXT_MASKBITS)
EXT_NETMASK=$(netmask $EXT_MASKBITS)
EXT_BROADCAST=$(broadcast $EXT_IP $EXT_MASKBITS)
- EXT_GW=$(first $EXT_ADDR)
+ test -z $EXT_GW && EXT_GW=$(first $EXT_ADDR)
fi
-MGT_IFACE=$5
-MGT_ADDR=$6
+MGT_IFACE=$6
+MGT_ADDR=$7
+MGT_GW=$8
if [ "$MGT_ADDR" != "dhcp" ]; then
MGT_IP=$(echo $MGT_ADDR | cut -d/ -f1)
MGT_MASKBITS=$(echo $MGT_ADDR | cut -d/ -f2)
MGT_NETWORK=$(network $MGT_IP $MGT_MASKBITS)
MGT_NETMASK=$(netmask $MGT_MASKBITS)
MGT_BROADCAST=$(broadcast $MGT_IP $MGT_MASKBITS)
- MGT_GW=$(first $MGT_ADDR)
+ test -z $MGT_GW && MGT_GW=$(first $MGT_ADDR)
fi
LIST_ETH=$(mktemp -u)
@@ -236,23 +235,23 @@
diff /etc/network/interfaces $IFACES_FILE 2>&1 > /dev/null
if [ $? -ne 0 ]; then
- CHANGED="true"
- cp /etc/network/interfaces /etc/network/interfaces.1
- cp $IFACES_FILE /etc/network/interfaces
+ CHANGED="true"
+ cp /etc/network/interfaces /etc/network/interfaces.1
+ cp $IFACES_FILE /etc/network/interfaces
fi
generate_persistent_names $LIST_FABRIC $LIST_ETH "$FAB_IFACE" "$EXT_IFACE"
if [ -r /etc/udev/rules.d/70-persistent-net.rules ]; then
- diff /etc/udev/rules.d/70-persistent-net.rules $NAMES_FILE 2>&1 > /dev/null
- if [ $? -ne 0 ]; then
- CHANGED="true"
- cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.1
- cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
- fi
+ diff /etc/udev/rules.d/70-persistent-net.rules $NAMES_FILE 2>&1 > /dev/null
+ if [ $? -ne 0 ]; then
+ CHANGED="true"
+ cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.1
+ cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
+ fi
else
- CHANGED="true"
- cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
+ CHANGED="true"
+ cp $NAMES_FILE /etc/udev/rules.d/70-persistent-net.rules
fi
rm -rf $IFACES_FILE
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index 1be091a..236fae4 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -108,6 +108,7 @@
- get-node-prov-state
- remove-xos-components
- post-fabric-config
+ - pull-latest-docker-images
- name: Verify Mellanox 40Gb NIC
shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
@@ -151,7 +152,7 @@
- name: Consistent Interface Naming
become: yes
- script: files/rename_ifaces.sh "{{ compute_node.interfaces.fabric }}" "{{ compute_node.addresses.fabric }}" "{{ compute_node.interfaces.external }}" "{{ compute_node.addresses.external }}" "{{ compute_node.interfaces.management }}" "{{ compute_node.addresses.management }}"
+ script: files/rename_ifaces.sh "{{ compute_node.interfaces.fabric }}" "{{ compute_node.addresses.fabric }}" "{{ compute_node.interfaces.external }}" "{{ compute_node.addresses.external }}" "{{ compute_node.gateway.external }}" "{{ compute_node.interfaces.management }}" "{{ compute_node.addresses.management }}" "{{ compute_node.gateway.management }}"
register: ifaces_changed
changed_when: ifaces_changed.stdout.find("true") != -1
tags:
diff --git a/roles/compute-node/vars/main.yml b/roles/compute-node/vars/main.yml
index 64316c3..05425ea 100644
--- a/roles/compute-node/vars/main.yml
+++ b/roles/compute-node/vars/main.yml
@@ -3,9 +3,12 @@
compute_node:
interfaces:
fabric: "{{ fabric_iface | default('fabric') }}"
- management: "{{ management_iface | default('br-mgmt') }}"
+ management: "{{ management_iface | default('mgmtbr') }}"
external: "{{ external_iface | default('') }}"
addresses:
fabric: "{{ fabric_ip | mandatory }}"
management: "{{ management_ip | default('dhcp') }}"
external: "{{ external_ip | default('manual') }}"
+ gateway:
+ external: "{{ external_gw | default('') }}"
+ management: "{{ management_gw | default('') }}"