From 842d54a2997adaf65369e56942e1d4f2b27aeb77 Mon Sep 17 00:00:00 2001 From: Ryota MIBU Date: Mon, 25 Dec 2017 16:28:50 +0900 Subject: [PATCH] use openstack command instead of nova command In function 'get_instance_ip', 'nova' client command is used to get instance information in order to retrive IP address of the instance. There is no need to use the nova command, since 'openstack' client already supports such basic operation. Moreover, 'openstack' client has an option to get value of specified column. That brings more accurate way of retriving IP address. This patch replaces nova command in 'get_instance_ip' by 'openstack' command. Note, this nova command is the only one in devstack tree. Change-Id: Iee0b81a994a4da5b3f4572c2e8eb30514cd43f89 Signed-off-by: Ryota MIBU --- functions | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions b/functions index 20b83b3cd0..959133ce5c 100644 --- a/functions +++ b/functions @@ -503,13 +503,13 @@ function ping_check { function get_instance_ip { local vm_id=$1 local network_name=$2 - local nova_result + local addresses local ip - nova_result="$(nova show $vm_id)" - ip=$(echo "$nova_result" | grep "$network_name" | get_field 2) + addresses=$(openstack server show -c addresses -f value "$vm_id") + ip=$(echo $addresses | sed -n "s/^.*$network_name=\([0-9\.]*\).*$/\1/p") if [[ $ip = "" ]];then - echo "$nova_result" + echo "addresses of server $vm_id : $addresses" die $LINENO "[Fail] Couldn't get ipaddress of VM" fi echo $ip