Browse code

Correct configuration setting using NUMBER_FAKE_NOVA_COMPUTE

In Change-Id Ia3843818014f7c6c7526ef3aa9676bbddb8a85ca the 'host'
setting used for each of the fake compute hosts was accidentally named
'nhost' ('\nhost' was edited poorly), so the setting doesn't actually do
anything: you create multiple nova-compute processes they think they are
all on the same host and only one hypervisor and resource provider is
created.

With the correction in place, the wait_for_compute function needs to be
updated to be aware of the fact that the hostnames on the compute
services will have a numeric prefix when the fake virt driver is used.

Change-Id: I5e8430d170c0b1c4f195ebe510aff8be59e4a3bc

Chris Dent authored on 2018/02/08 03:35:40
Showing 2 changed files
... ...
@@ -446,7 +446,12 @@ function wait_for_compute {
446 446
         ID=""
447 447
         while [[ "\$ID" == "" ]]; do
448 448
             sleep 1
449
-            ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value)
449
+            if [[ "$VIRT_DRIVER" = 'fake' ]]; then
450
+                # When using the fake driver the compute hostnames have a suffix of 1 to NUMBER_FAKE_NOVA_COMPUTE
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
+            else
453
+                ID=\$(openstack --os-cloud devstack-admin --os-region "$REGION_NAME" compute service list --host `hostname` --service nova-compute -c ID -f value)
454
+            fi
450 455
         done
451 456
 EOF
452 457
     time_stop "wait_for_service"
... ...
@@ -877,7 +877,7 @@ function start_nova_compute {
877 877
             # creating or modifying real configurations. Each fake
878 878
             # gets its own configuration and own log file.
879 879
             local fake_conf="${NOVA_FAKE_CONF}-${i}"
880
-            iniset $fake_conf DEFAULT nhost "${HOSTNAME}${i}"
880
+            iniset $fake_conf DEFAULT host "${HOSTNAME}${i}"
881 881
             run_process "n-cpu-${i}" "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CPU_CONF --config-file $fake_conf"
882 882
         done
883 883
     else