Adds overcloud external connectivity test and adds NAT to instack VM if 39/17539/3
authorMarkus Kullberg <markus.kullberg@nokia.com>
Tue, 26 Jul 2016 06:37:43 +0000 (09:37 +0300)
committerMarkus Kullberg <markus.kullberg@nokia.com>
Tue, 2 Aug 2016 07:18:25 +0000 (10:18 +0300)
needed

JIRA: APEX-198

Adds support for baremetal deployments where external connectivity is only
provided via the jumphost. The connectivity test is done by pinging an
external IP (8.8.8.8 by default) for each node. If ping fails for any of
the nodes then NAT is added.

Change-Id: I8d59beb03c3b2998deaec5dc7536fa7a5b1f7718
Signed-off-by: Markus Kullberg <markus.kullberg@nokia.com>
lib/common-functions.sh
lib/post-install-functions.sh

index 391d940..6941093 100644 (file)
@@ -293,3 +293,16 @@ function verify_internet {
     return 1
   fi
 }
+
+##tests if overcloud nodes have external connectivity
+#params:none
+function test_overcloud_connectivity {
+  for node in $(undercloud_connect stack ". stackrc && nova list" | grep -Eo "controller-[0-9]+|compute-[0-9]+" | tr -d -) ; do
+    if ! overcloud_connect $node "ping -c 2 $ping_site > /dev/null"; then
+      echo "${blue}Node ${node} was unable to ping site ${ping_site}${reset}"
+      return 1
+    fi
+  done
+  echo "${blue}Overcloud external connectivity OK${reset}"
+}
+
index bf0b444..a7499fe 100755 (executable)
@@ -123,7 +123,8 @@ fi
 EOI
 
   # for virtual, we NAT public network through Undercloud
-  if [ "$virtual" == "TRUE" ] && [ "$public_network_ipv6" != "True" ]; then
+  # same goes for baremetal if only jumphost has external connectivity
+  if [ "$virtual" == "TRUE" ] || ! test_overcloud_connectivity && [ "$public_network_ipv6" != "True" ]; then
     if ! configure_undercloud_nat ${public_network_cidr}; then
       echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${public_network_cidr}${reset}"
       exit 1