X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=validation-scripts%2Fall-nodes.sh;h=296dcd365f54461f8084e99e512a4f0926eef3b7;hb=e2d302cbacaec70588a2e7d4e42462832c072ed7;hp=1c834e76b266e3dc3d5a149adfa3dbc5e4a49039;hpb=cab8f750a91238a1e3227d40c81e4c40188a621d;p=apex-tripleo-heat-templates.git diff --git a/validation-scripts/all-nodes.sh b/validation-scripts/all-nodes.sh index 1c834e76..296dcd36 100644 --- a/validation-scripts/all-nodes.sh +++ b/validation-scripts/all-nodes.sh @@ -10,12 +10,13 @@ function ping_retry() { PING_CMD=ping6 fi until [ $COUNT -ge $TIMES ]; do - if $PING_CMD -W 300 -c 1 $IP_ADDR &> /dev/null; then + if $PING_CMD -w 10 -c 1 $IP_ADDR &> /dev/null; then echo "Ping to $IP_ADDR succeeded." return 0 fi echo "Ping to $IP_ADDR failed. Retrying..." COUNT=$(($COUNT + 1)) + sleep 60 done return 1 } @@ -67,5 +68,53 @@ function ping_default_gateways() { echo "SUCCESS" } +# Verify the FQDN from the nova/ironic deployment matches +# FQDN in the heat templates. +function fqdn_check() { + HOSTNAME=$(hostname) + SHORT_NAME=$(hostname -s) + FQDN_FROM_HOSTS=$(awk '$3 == "'${SHORT_NAME}'"{print $2}' /etc/hosts) + echo -n "Checking hostname vs /etc/hosts entry..." + if [[ $HOSTNAME != $FQDN_FROM_HOSTS ]]; then + echo "FAILURE" + echo -e "System hostname: ${HOSTNAME}\nEntry from /etc/hosts: ${FQDN_FROM_HOSTS}\n" + exit 1 + fi + echo "SUCCESS" +} + +# Verify at least one time source is available. +function ntp_check() { + NTP_SERVERS=$(hiera ntp::servers nil |tr -d '[],"') + if [[ "$NTP_SERVERS" != "nil" ]];then + echo -n "Testing NTP..." + NTP_SUCCESS=0 + for NTP_SERVER in $NTP_SERVERS; do + set +e + NTPDATE_OUT=$(ntpdate -qud $NTP_SERVER 2>&1) + NTPDATE_EXIT=$? + set -e + if [[ "$NTPDATE_EXIT" == "0" ]];then + NTP_SUCCESS=1 + break + else + NTPDATE_OUT_FULL="$NTPDATE_OUT_FULL $NTPDATE_OUT" + fi + done + if [[ "$NTP_SUCCESS" == "0" ]];then + echo "FAILURE" + echo "$NTPDATE_OUT_FULL" + exit 1 + fi + echo "SUCCESS" + fi +} + ping_controller_ips "$ping_test_ips" ping_default_gateways +if [[ $validate_fqdn == "True" ]];then + fqdn_check +fi +if [[ $validate_ntp == "True" ]];then + ntp_check +fi