Browse code

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>

Prabhat Ranjan authored on 2018/03/16 20:03:46
Showing 1 changed files
... ...
@@ -441,7 +441,12 @@ EOF
441 441
 function wait_for_compute {
442 442
     local timeout=$1
443 443
     local rval=0
444
+    local compute_hostname
444 445
     time_start "wait_for_service"
446
+    compute_hostname=$(iniget $NOVA_CONF DEFAULT host)
447
+    if [[ -z $compute_hostname ]]; then
448
+        compute_hostname=$(hostname)
449
+    fi
445 450
     timeout $timeout bash -x <<EOF || rval=$?
446 451
         ID=""
447 452
         while [[ "\$ID" == "" ]]; do
... ...
@@ -450,7 +455,7 @@ function wait_for_compute {
450 450
                 # When using the fake driver the compute hostnames have a suffix of 1 to NUMBER_FAKE_NOVA_COMPUTE
451 451
                 ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname`1 --service nova-compute -c ID -f value)
452 452
             else
453
-                ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value)
453
+                ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host "$compute_hostname" --service nova-compute -c ID -f value)
454 454
             fi
455 455
         done
456 456
 EOF