Move step to wait for external network at the beginning
Related-Prod: PRODX-3456
Change-Id: I54ebd07c640e138ef4cb848ee54434b3dd51cc62
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index e3a8969..e160b24 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -521,6 +521,13 @@
systemctl restart ntp
}
+function wait_for_external_network {
+ function _check_access {
+ curl --connect-timeout 10 ${DOCKER_UCP_IMAGE%%/*} || (sleep 1; /bin/false)
+ }
+ retry 180 "Failed to wait for external networks reachable." _check_access
+}
+
function prepare_network {
if [ -z "${CONTROL_IP_ADDRESS}" ]; then
wait_condition_send "FAILURE" "CONTROL_IP_ADDRESS is not found."
@@ -530,12 +537,6 @@
systemctl restart systemd-resolved
# Make sure local hostname is present in /etc/hosts
sed -i "s/127.0.0.1 localhost/127.0.0.1 localhost\n${CONTROL_IP_ADDRESS} $(hostname -s).cluster.local $(hostname -s)/" /etc/hosts
-
- function _check_access {
- curl --connect-timeout 10 ${DOCKER_UCP_IMAGE%%/*} || (sleep 1; /bin/false)
- }
-
- retry 180 "Failed to wait for external networks reachable." _check_access
}
function workaround_default_forward_policy {
@@ -1000,6 +1001,7 @@
# Please keep the "prepare_metadata_files", "disable-rp-filter", "network_config" and "prepare_network" functions
# at the very beginning in the same order.
ucp)
+ wait_for_external_network
prepare_metadata_files
disable_rp_filter
network_config
@@ -1039,6 +1041,7 @@
cron_disable_calico_offloading
;;
master)
+ wait_for_external_network
nested_virt_config
prepare_metadata_files
disable_rp_filter
@@ -1069,6 +1072,7 @@
cron_disable_calico_offloading
;;
worker)
+ wait_for_external_network
if [[ "${CONFIGURE_HUGE_PAGES}" == true ]]; then
configure_huge_pages
fi
@@ -1108,6 +1112,7 @@
cron_disable_calico_offloading
;;
spare)
+ wait_for_external_network
prepare_metadata_files
disable_rp_filter
network_config
@@ -1131,6 +1136,7 @@
cron_disable_calico_offloading
;;
frr)
+ wait_for_external_network
prepare_metadata_files
disable_rp_filter
network_config