Added functions for get a ip on an instance
The cause of some gating failure looks like
because of getting ip address on instance.
However current exercise didn't log the return value.
In this commit, we add get_instance_ip function with
error hanlding support, and apply it on the execise.
Change-Id: I8e17ba68093faafe58a98eb780a032368eea38aa
diff --git a/functions b/functions
index 087a0ea..b56df08 100644
--- a/functions
+++ b/functions
@@ -1433,6 +1433,19 @@
fi
}
+# Get ip of instance
+function get_instance_ip(){
+ local vm_id=$1
+ local network_name=$2
+ local nova_result="$(nova show $vm_id)"
+ local ip=$(echo "$nova_result" | grep "$network_name" | get_field 2)
+ if [[ $ip = "" ]];then
+ echo "$nova_result"
+ die $LINENO "[Fail] Coudn't get ipaddress of VM"
+ exit 1
+ fi
+ echo $ip
+}
# ssh check