Browse code

Merge "Configure console proxy ports in nova-cpu.conf"

Zuul authored on 2019/08/02 21:07:35
Showing 1 changed files
... ...
@@ -578,23 +578,34 @@ function configure_placement_nova_compute {
578 578
 }
579 579
 
580 580
 function configure_console_compute {
581
+    # If we are running multiple cells (and thus multiple console proxies) on a
582
+    # single host, we offset the ports to avoid collisions.  We need to
583
+    # correspondingly configure the console proxy port for nova-compute and we
584
+    # can use the NOVA_CPU_CELL variable to know which cell we are for
585
+    # calculating the offset.
586
+    # Stagger the offset based on the total number of possible console proxies
587
+    # (novnc, xvpvnc, spice, serial) so that their ports will not collide if
588
+    # all are enabled.
589
+    local offset
590
+    offset=$(((NOVA_CPU_CELL - 1) * 4))
591
+
581 592
     # All nova-compute workers need to know the vnc configuration options
582 593
     # These settings don't hurt anything if n-xvnc and n-novnc are disabled
583 594
     if is_service_enabled n-cpu; then
584 595
         if [ "$NOVNC_FROM_PACKAGE" == "True" ]; then
585 596
             # Use the old URL when installing novnc packages.
586
-            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
597
+            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:$((6080 + offset))/vnc_auto.html"}
587 598
         elif vercmp ${NOVNC_BRANCH} "<" "1.0.0"; then
588
-             # Use the old URL when installing older novnc source.
589
-            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_auto.html"}
599
+            # Use the old URL when installing older novnc source.
600
+            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:$((6080 + offset))/vnc_auto.html"}
590 601
         else
591 602
             # Use the new URL when building >=v1.0.0 from source.
592
-            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:6080/vnc_lite.html"}
603
+            NOVNCPROXY_URL=${NOVNCPROXY_URL:-"http://$SERVICE_HOST:$((6080 + offset))/vnc_lite.html"}
593 604
         fi
594 605
         iniset $NOVA_CPU_CONF vnc novncproxy_base_url "$NOVNCPROXY_URL"
595
-        XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:6081/console"}
606
+        XVPVNCPROXY_URL=${XVPVNCPROXY_URL:-"http://$SERVICE_HOST:$((6081 + offset))/console"}
596 607
         iniset $NOVA_CPU_CONF vnc xvpvncproxy_base_url "$XVPVNCPROXY_URL"
597
-        SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"}
608
+        SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:$((6082 + offset))/spice_auto.html"}
598 609
         iniset $NOVA_CPU_CONF spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
599 610
     fi
600 611
 
... ...
@@ -621,6 +632,7 @@ function configure_console_compute {
621 621
 
622 622
     if is_service_enabled n-sproxy; then
623 623
         iniset $NOVA_CPU_CONF serial_console enabled True
624
+        iniset $NOVA_CPU_CONF serial_console base_url "ws://$SERVICE_HOST:$((6083 + offset))/"
624 625
     fi
625 626
 }
626 627