Fix wait_for_compute to work for modified compute host name

When we change the name of compute host then devstack is breaking
because it is using default host name from host.

How to change compute host name in local.conf
[[post-config|$NOVA_CONF]]
[DEFAULT]
host = foo

Change-Id: I4d4392f1f58f0431b10764610668565af88d392f
Signed-off-by: Prabhat Ranjan <pranjank@in.ibm.com>
This commit is contained in:
Prabhat Ranjan 2018-03-16 16:33:46 +05:30
parent 5ebfe6dcb0
commit 6f38cf4ad8

View File

@ -441,7 +441,12 @@ EOF
function wait_for_compute { function wait_for_compute {
local timeout=$1 local timeout=$1
local rval=0 local rval=0
local compute_hostname
time_start "wait_for_service" time_start "wait_for_service"
compute_hostname=$(iniget $NOVA_CONF DEFAULT host)
if [[ -z $compute_hostname ]]; then
compute_hostname=$(hostname)
fi
timeout $timeout bash -x <<EOF || rval=$? timeout $timeout bash -x <<EOF || rval=$?
ID="" ID=""
while [[ "\$ID" == "" ]]; do while [[ "\$ID" == "" ]]; do
@ -450,7 +455,7 @@ function wait_for_compute {
# When using the fake driver the compute hostnames have a suffix of 1 to NUMBER_FAKE_NOVA_COMPUTE # When using the fake driver the compute hostnames have a suffix of 1 to NUMBER_FAKE_NOVA_COMPUTE
ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname`1 --service nova-compute -c ID -f value) ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname`1 --service nova-compute -c ID -f value)
else else
ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value) ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host "$compute_hostname" --service nova-compute -c ID -f value)
fi fi
done done
EOF EOF