Browse code

Set console server host/address in nova-cpu.conf for multi-host

Currently, the console server host and listen address on the compute
host is always being set to localhost. This works fine in a single
node all-in-one deployment, but will not work properly when
nova-compute is running on a separate host in a multi-node deployment.

This sets the console server host and listen address on the compute
host to the nova host IP and service listen address instead of the
localhost.

Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>

Closes-Bug: #1669468

Change-Id: Id8b0b4159b98c7ff3c85ec3daa03d556d9897ce9

melanie witt authored on 2019/08/10 00:57:50
Showing 1 changed files
... ...
@@ -88,7 +88,6 @@ NOVA_SERVICE_HOST=${NOVA_SERVICE_HOST:-$SERVICE_HOST}
88 88
 NOVA_SERVICE_PORT=${NOVA_SERVICE_PORT:-8774}
89 89
 NOVA_SERVICE_PORT_INT=${NOVA_SERVICE_PORT_INT:-18774}
90 90
 NOVA_SERVICE_PROTOCOL=${NOVA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
91
-NOVA_SERVICE_LOCAL_HOST=${NOVA_SERVICE_LOCAL_HOST:-$SERVICE_LOCAL_HOST}
92 91
 NOVA_SERVICE_LISTEN_ADDRESS=${NOVA_SERVICE_LISTEN_ADDRESS:-$(ipv6_unquote $SERVICE_LISTEN_ADDRESS)}
93 92
 METADATA_SERVICE_PORT=${METADATA_SERVICE_PORT:-8775}
94 93
 NOVA_ENABLE_CACHE=${NOVA_ENABLE_CACHE:-True}
... ...
@@ -597,6 +596,11 @@ function configure_console_compute {
597 597
     local offset
598 598
     offset=$(((NOVA_CPU_CELL - 1) * 4))
599 599
 
600
+    # Use the host IP instead of the service host because for multi-node, the
601
+    # service host will be the controller only.
602
+    local default_proxyclient_addr
603
+    default_proxyclient_addr=$(iniget $NOVA_CPU_CONF DEFAULT my_ip)
604
+
600 605
     # All nova-compute workers need to know the vnc configuration options
601 606
     # These settings don't hurt anything if n-xvnc and n-novnc are disabled
602 607
     if is_service_enabled n-cpu; then
... ...
@@ -620,8 +624,8 @@ function configure_console_compute {
620 620
     if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
621 621
         # Address on which instance vncservers will listen on compute hosts.
622 622
         # For multi-host, this should be the management ip of the compute host.
623
-        VNCSERVER_LISTEN=${VNCSERVER_LISTEN:-$NOVA_SERVICE_LOCAL_HOST}
624
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS:-$NOVA_SERVICE_LOCAL_HOST}
623
+        VNCSERVER_LISTEN=${VNCSERVER_LISTEN:-$NOVA_SERVICE_LISTEN_ADDRESS}
624
+        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS:-$default_proxyclient_addr}
625 625
         iniset $NOVA_CPU_CONF vnc server_listen "$VNCSERVER_LISTEN"
626 626
         iniset $NOVA_CPU_CONF vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
627 627
     else
... ...
@@ -631,8 +635,8 @@ function configure_console_compute {
631 631
     if is_service_enabled n-spice; then
632 632
         # Address on which instance spiceservers will listen on compute hosts.
633 633
         # For multi-host, this should be the management ip of the compute host.
634
-        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
635
-        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
634
+        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS:-$default_proxyclient_addr}
635
+        SPICESERVER_LISTEN=${SPICESERVER_LISTEN:-$NOVA_SERVICE_LISTEN_ADDRESS}
636 636
         iniset $NOVA_CPU_CONF spice enabled true
637 637
         iniset $NOVA_CPU_CONF spice server_listen "$SPICESERVER_LISTEN"
638 638
         iniset $NOVA_CPU_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"