Browse code

Configure console proxy settings for nova-cpu.conf

Change 12579c3db7b28381c8ec97945aa23ee02d54d22b moved console-related
settings from the global nova.conf to the per cell nova_cellN.conf
because of a recent change in nova that moved console token
authorizations from the nova-consoleauth service backend to the
database backend and thus changed the deployment layout requirements
from global console proxies to per cell console proxies.

The change erroneously also removed console configuration settings from
the nova-compute config file nova-cpu.conf because the nova-cpu.conf
begins as a copy of the global nova.conf.

This adds configuration of console proxies to the nova-cpu.conf in the
start_nova_compute routine. The settings have also been split up to
clarify which settings are used by the console proxy and which settings
are used by nova-compute.

Closes-Bug: #1770143

Change-Id: I2a98795674183e2c05c29e15a3a3bad1a22c0891

melanie witt authored on 2018/05/10 02:55:40
Showing 1 changed files
... ...
@@ -606,19 +606,16 @@ function create_nova_conf {
606 606
     fi
607 607
 }
608 608
 
609
-function configure_console_proxies {
610
-    # Use the provided config file path or default to $NOVA_CONF.
611
-    local conf=${1:-$NOVA_CONF}
612
-
609
+function configure_console_compute {
613 610
     # All nova-compute workers need to know the vnc configuration options
614 611
     # These settings don't hurt anything if n-xvnc and n-novnc are disabled
615 612
     if is_service_enabled n-cpu; then
616 613
         NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
617
-        iniset $conf vnc novncproxy_base_url "$NOVNCPROXY_URL"
614
+        iniset $NOVA_CPU_CONF vnc novncproxy_base_url "$NOVNCPROXY_URL"
618 615
         XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"}
619
-        iniset $conf vnc xvpvncproxy_base_url "$XVPVNCPROXY_URL"
616
+        iniset $NOVA_CPU_CONF vnc xvpvncproxy_base_url "$XVPVNCPROXY_URL"
620 617
         SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"}
621
-        iniset $conf spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
618
+        iniset $NOVA_CPU_CONF spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
622 619
     fi
623 620
 
624 621
     if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
... ...
@@ -626,8 +623,32 @@ function configure_console_proxies {
626 626
         # For multi-host, this should be the management ip of the compute host.
627 627
         VNCSERVER_LISTEN=${VNCSERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
628 628
         VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
629
-        iniset $conf vnc server_listen "$VNCSERVER_LISTEN"
630
-        iniset $conf vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
629
+        iniset $NOVA_CPU_CONF vnc server_listen "$VNCSERVER_LISTEN"
630
+        iniset $NOVA_CPU_CONF vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
631
+    else
632
+        iniset $NOVA_CPU_CONF vnc enabled false
633
+    fi
634
+
635
+    if is_service_enabled n-spice; then
636
+        # Address on which instance spiceservers will listen on compute hosts.
637
+        # For multi-host, this should be the management ip of the compute host.
638
+        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
639
+        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
640
+        iniset $NOVA_CPU_CONF spice enabled true
641
+        iniset $NOVA_CPU_CONF spice server_listen "$SPICESERVER_LISTEN"
642
+        iniset $NOVA_CPU_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
643
+    fi
644
+
645
+    if is_service_enabled n-sproxy; then
646
+        iniset $NOVA_CPU_CONF serial_console enabled True
647
+    fi
648
+}
649
+
650
+function configure_console_proxies {
651
+    # Use the provided config file path or default to $NOVA_CONF.
652
+    local conf=${1:-$NOVA_CONF}
653
+
654
+    if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
631 655
         iniset $conf vnc novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
632 656
         iniset $conf vnc xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
633 657
 
... ...
@@ -641,24 +662,14 @@ function configure_console_proxies {
641 641
             deploy_int_CA /etc/pki/nova-novnc/ca-cert.pem
642 642
             deploy_int_cert /etc/pki/nova-novnc/client-cert.pem /etc/pki/nova-novnc/client-key.pem
643 643
         fi
644
-    else
645
-        iniset $conf vnc enabled false
646 644
     fi
647 645
 
648 646
     if is_service_enabled n-spice; then
649
-        # Address on which instance spiceservers will listen on compute hosts.
650
-        # For multi-host, this should be the management ip of the compute host.
651
-        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
652
-        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
653
-        iniset $conf spice enabled true
654
-        iniset $conf spice server_listen "$SPICESERVER_LISTEN"
655
-        iniset $conf spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
656 647
         iniset $conf spice html5proxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
657 648
     fi
658 649
 
659 650
     if is_service_enabled n-sproxy; then
660 651
         iniset $conf serial_console serialproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
661
-        iniset $conf serial_console enabled True
662 652
     fi
663 653
 }
664 654
 
... ...
@@ -911,6 +922,11 @@ function start_nova_compute {
911 911
         iniset_rpc_backend nova $NOVA_CPU_CONF DEFAULT "nova_cell${NOVA_CPU_CELL}"
912 912
     fi
913 913
 
914
+    # Console proxies were configured earlier in create_nova_conf. Now that the
915
+    # nova-cpu.conf has been created, configure the console settings required
916
+    # by the compute process.
917
+    configure_console_compute
918
+
914 919
     if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
915 920
         # The group **$LIBVIRT_GROUP** is added to the current user in this script.
916 921
         # ``sg`` is used in run_process to execute nova-compute as a member of the