Browse code

Set console proxy configuration according to cells v2 setup

Change 969239029d4a13956747e6e0b850d6c6ab4035f0 completed the
conversion of console token authorization storage from the
nova-consoleauth service to the database backend. With this change,
console proxies need to be configured on a per cell basis instead
of globally.

There was a devstack change 6645cf7a26428f3af1e4739ac29c6a90b67f99dc
following it that re-enabled the novnc tempest tests, but the nova-next
job that runs the console proxies with TLS is *not* part of the normal
set of jobs that run on devstack changes (it's in the experimental
queue), so it was able to merge without the nova-next job passing.

This configures the nova console proxies in the per cell configuration
file if cells v2 is configured for multiple cells in order to pass the
nova-next job.

Closes-Bug: #1769286

Change-Id: Ic4fff4c59eda43dd1bc6e7b645b513b46b57c235

melanie witt authored on 2018/05/06 08:55:32
Showing 1 changed files
... ...
@@ -524,52 +524,6 @@ function create_nova_conf {
524 524
         iniset $NOVA_CONF DEFAULT notify_on_state_change "vm_and_task_state"
525 525
     fi
526 526
 
527
-    # All nova-compute workers need to know the vnc configuration options
528
-    # These settings don't hurt anything if n-xvnc and n-novnc are disabled
529
-    if is_service_enabled n-cpu; then
530
-        NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
531
-        iniset $NOVA_CONF vnc novncproxy_base_url "$NOVNCPROXY_URL"
532
-        XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"}
533
-        iniset $NOVA_CONF vnc xvpvncproxy_base_url "$XVPVNCPROXY_URL"
534
-        SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"}
535
-        iniset $NOVA_CONF spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
536
-    fi
537
-
538
-    if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
539
-        # Address on which instance vncservers will listen on compute hosts.
540
-        # For multi-host, this should be the management ip of the compute host.
541
-        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
542
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
543
-        iniset $NOVA_CONF vnc server_listen "$VNCSERVER_LISTEN"
544
-        iniset $NOVA_CONF vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
545
-        iniset $NOVA_CONF vnc novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
546
-        iniset $NOVA_CONF vnc xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
547
-
548
-        if is_nova_console_proxy_compute_tls_enabled ; then
549
-            iniset $NOVA_CONF vnc auth_schemes "vencrypt"
550
-            iniset $NOVA_CONF vnc vencrypt_client_key "/etc/pki/nova-novnc/client-key.pem"
551
-            iniset $NOVA_CONF vnc vencrypt_client_cert "/etc/pki/nova-novnc/client-cert.pem"
552
-            iniset $NOVA_CONF vnc vencrypt_ca_certs "/etc/pki/nova-novnc/ca-cert.pem"
553
-
554
-            sudo mkdir -p /etc/pki/nova-novnc
555
-            deploy_int_CA /etc/pki/nova-novnc/ca-cert.pem
556
-            deploy_int_cert /etc/pki/nova-novnc/client-cert.pem /etc/pki/nova-novnc/client-key.pem
557
-        fi
558
-    else
559
-        iniset $NOVA_CONF vnc enabled false
560
-    fi
561
-
562
-    if is_service_enabled n-spice; then
563
-        # Address on which instance spiceservers will listen on compute hosts.
564
-        # For multi-host, this should be the management ip of the compute host.
565
-        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
566
-        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
567
-        iniset $NOVA_CONF spice enabled true
568
-        iniset $NOVA_CONF spice server_listen "$SPICESERVER_LISTEN"
569
-        iniset $NOVA_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
570
-        iniset $NOVA_CONF spice html5proxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
571
-    fi
572
-
573 527
     # Set the oslo messaging driver to the typical default. This does not
574 528
     # enable notifications, but it will allow them to function when enabled.
575 529
     iniset $NOVA_CONF oslo_messaging_notifications driver "messagingv2"
... ...
@@ -588,10 +542,6 @@ function create_nova_conf {
588 588
         iniset $NOVA_CONF oslo_middleware enable_proxy_headers_parsing True
589 589
     fi
590 590
 
591
-    if is_service_enabled n-sproxy; then
592
-        iniset $NOVA_CONF serial_console serialproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
593
-        iniset $NOVA_CONF serial_console enabled True
594
-    fi
595 591
     iniset $NOVA_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
596 592
 
597 593
     # Setup logging for nova-dhcpbridge command line
... ...
@@ -641,6 +591,75 @@ function create_nova_conf {
641 641
             setup_logging $conf
642 642
         done
643 643
     fi
644
+
645
+    # Console proxy configuration has to go after conductor configuration
646
+    # because the per cell config file nova_cellN.conf is cleared out as part
647
+    # of conductor configuration.
648
+    if [[ "${CELLSV2_SETUP}" == "singleconductor" ]]; then
649
+        configure_console_proxies
650
+    else
651
+        for i in $(seq 1 $NOVA_NUM_CELLS); do
652
+            local conf
653
+            conf=$(conductor_conf $i)
654
+            configure_console_proxies $conf
655
+        done
656
+    fi
657
+}
658
+
659
+function configure_console_proxies {
660
+    # Use the provided config file path or default to $NOVA_CONF.
661
+    local conf=${1:-$NOVA_CONF}
662
+
663
+    # All nova-compute workers need to know the vnc configuration options
664
+    # These settings don't hurt anything if n-xvnc and n-novnc are disabled
665
+    if is_service_enabled n-cpu; then
666
+        NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
667
+        iniset $conf vnc novncproxy_base_url "$NOVNCPROXY_URL"
668
+        XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"}
669
+        iniset $conf vnc xvpvncproxy_base_url "$XVPVNCPROXY_URL"
670
+        SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"}
671
+        iniset $conf spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
672
+    fi
673
+
674
+    if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
675
+        # Address on which instance vncservers will listen on compute hosts.
676
+        # For multi-host, this should be the management ip of the compute host.
677
+        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
678
+        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
679
+        iniset $conf vnc server_listen "$VNCSERVER_LISTEN"
680
+        iniset $conf vnc server_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
681
+        iniset $conf vnc novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
682
+        iniset $conf vnc xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
683
+
684
+        if is_nova_console_proxy_compute_tls_enabled ; then
685
+            iniset $conf vnc auth_schemes "vencrypt"
686
+            iniset $conf vnc vencrypt_client_key "/etc/pki/nova-novnc/client-key.pem"
687
+            iniset $conf vnc vencrypt_client_cert "/etc/pki/nova-novnc/client-cert.pem"
688
+            iniset $conf vnc vencrypt_ca_certs "/etc/pki/nova-novnc/ca-cert.pem"
689
+
690
+            sudo mkdir -p /etc/pki/nova-novnc
691
+            deploy_int_CA /etc/pki/nova-novnc/ca-cert.pem
692
+            deploy_int_cert /etc/pki/nova-novnc/client-cert.pem /etc/pki/nova-novnc/client-key.pem
693
+        fi
694
+    else
695
+        iniset $conf vnc enabled false
696
+    fi
697
+
698
+    if is_service_enabled n-spice; then
699
+        # Address on which instance spiceservers will listen on compute hosts.
700
+        # For multi-host, this should be the management ip of the compute host.
701
+        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
702
+        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
703
+        iniset $conf spice enabled true
704
+        iniset $conf spice server_listen "$SPICESERVER_LISTEN"
705
+        iniset $conf spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
706
+        iniset $conf spice html5proxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
707
+    fi
708
+
709
+    if is_service_enabled n-sproxy; then
710
+        iniset $conf serial_console serialproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
711
+        iniset $conf serial_console enabled True
712
+    fi
644 713
 }
645 714
 
646 715
 function init_nova_service_user_conf {