@@ -578,23 +578,34 @@ function configure_placement_nova_compute {
578578}
579579
580580function 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+
581592 # All nova-compute workers need to know the vnc configuration options
582593 # These settings don't hurt anything if n-xvnc and n-novnc are disabled
583594 if is_service_enabled n-cpu; then
584595 if [ " $NOVNC_FROM_PACKAGE " == " True" ]; then
585596 # 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" }
587598 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" }
590601 else
591602 # 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" }
593604 fi
594605 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" }
596607 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" }
598609 iniset $NOVA_CPU_CONF spice html5proxy_base_url " $SPICEHTML5PROXY_URL "
599610 fi
600611
@@ -621,6 +632,7 @@ function configure_console_compute {
621632
622633 if is_service_enabled n-sproxy; then
623634 iniset $NOVA_CPU_CONF serial_console enabled True
635+ iniset $NOVA_CPU_CONF serial_console base_url " ws://$SERVICE_HOST :$(( 6083 + offset)) /"
624636 fi
625637}
626638
0 commit comments