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 <r-mibu@cq.jp.nec.com>
This commit is contained in:
parent
614cab33c4
commit
842d54a299
@ -503,13 +503,13 @@ function ping_check {
|
|||||||
function get_instance_ip {
|
function get_instance_ip {
|
||||||
local vm_id=$1
|
local vm_id=$1
|
||||||
local network_name=$2
|
local network_name=$2
|
||||||
local nova_result
|
local addresses
|
||||||
local ip
|
local ip
|
||||||
|
|
||||||
nova_result="$(nova show $vm_id)"
|
addresses=$(openstack server show -c addresses -f value "$vm_id")
|
||||||
ip=$(echo "$nova_result" | grep "$network_name" | get_field 2)
|
ip=$(echo $addresses | sed -n "s/^.*$network_name=\([0-9\.]*\).*$/\1/p")
|
||||||
if [[ $ip = "" ]];then
|
if [[ $ip = "" ]];then
|
||||||
echo "$nova_result"
|
echo "addresses of server $vm_id : $addresses"
|
||||||
die $LINENO "[Fail] Couldn't get ipaddress of VM"
|
die $LINENO "[Fail] Couldn't get ipaddress of VM"
|
||||||
fi
|
fi
|
||||||
echo $ip
|
echo $ip
|
||||||
|
Loading…
Reference in New Issue
Block a user