Browse code

Merge "Add IPv6 support to devstack infrastructure"

Jenkins authored on 2015/07/08 21:44:51
Showing 13 changed files
... ...
@@ -361,6 +361,22 @@ Be aware that there are some features currently missing in cells, one notable
361 361
 one being security groups.  The exercises have been patched to disable
362 362
 functionality not supported by cells.
363 363
 
364
+# IPv6
365
+
366
+By default, most Openstack services are bound to 0.0.0.0
367
+and service endpoints are registered as IPv4 addresses.
368
+A new variable was created to control this behavior, and to
369
+allow for operation over IPv6 instead of IPv4.
370
+
371
+For this, add the following to `local.conf`:
372
+
373
+    SERVICE_IP_VERSION=6
374
+
375
+When set to "6" devstack services will open listen sockets on ::
376
+and service endpoints will be registered using HOST_IPV6 as the
377
+address.  The default value for this setting is `4`.  Dual-mode
378
+support, for example `4+6` is not currently supported.
379
+
364 380
 
365 381
 # Local Configuration
366 382
 
... ...
@@ -137,6 +137,11 @@ Ethernet interface to a bridge on the host. Setting it here also makes it
137 137
 available for ``openrc`` to set ``OS_AUTH_URL``. ``HOST_IP`` is not set
138 138
 by default.
139 139
 
140
+``HOST_IPV6`` is normally detected on the first run of ``stack.sh`` but
141
+will not be set if there is no IPv6 address on the default Ethernet interface.
142
+Setting it here also makes it available for ``openrc`` to set ``OS_AUTH_URL``.
143
+``HOST_IPV6`` is not set by default.
144
+
140 145
 Common Configuration Variables
141 146
 ==============================
142 147
 
... ...
@@ -391,6 +396,8 @@ Multi-host DevStack
391 391
         ENABLED_SERVICES=n-vol,n-cpu,n-net,n-api
392 392
 
393 393
 IP Version
394
+----------
395
+
394 396
     | Default: ``IP_VERSION=4+6``
395 397
     | This setting can be used to configure DevStack to create either an IPv4,
396 398
       IPv6, or dual stack tenant data network by setting ``IP_VERSION`` to
... ...
@@ -418,6 +425,25 @@ IP Version
418 418
     | *Note: ``FIXED_RANGE_V6`` and ``IPV6_PRIVATE_NETWORK_GATEWAY``
419 419
       can be configured with any valid IPv6 prefix. The default values make
420 420
       use of an auto-generated ``IPV6_GLOBAL_ID`` to comply with RFC 4193.*
421
+    |
422
+
423
+    | Default: ``SERVICE_IP_VERSION=4``
424
+    | This setting can be used to configure DevStack to enable services to
425
+      operate over either IPv4 or IPv6, by setting ``SERVICE_IP_VERSION`` to
426
+      either ``SERVICE_IP_VERSION=4`` or ``SERVICE_IP_VERSION=6`` respectively.
427
+      When set to ``4`` devstack services will open listen sockets on 0.0.0.0
428
+      and service endpoints will be registered using ``HOST_IP`` as the address.
429
+      When set to ``6`` devstack services will open listen sockets on :: and
430
+      service endpoints will be registered using ``HOST_IPV6`` as the address.
431
+      The default value for this setting is ``4``.  Dual-mode support, for
432
+      example ``4+6`` is not currently supported.
433
+    | The following optional variable can be used to alter the default IPv6
434
+      address used:
435
+    |
436
+
437
+    ::
438
+
439
+        HOST_IPV6=${some_local_ipv6_address}
421 440
 
422 441
 Examples
423 442
 ========
... ...
@@ -46,7 +46,8 @@ TRACK_DEPENDS=${TRACK_DEPENDS:-False}
46 46
 # Save these variables to .stackenv
47 47
 STACK_ENV_VARS="BASE_SQL_CONN DATA_DIR DEST ENABLED_SERVICES HOST_IP \
48 48
     KEYSTONE_AUTH_PROTOCOL KEYSTONE_AUTH_URI KEYSTONE_SERVICE_URI \
49
-    LOGFILE OS_CACERT SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP"
49
+    LOGFILE OS_CACERT SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP \
50
+    HOST_IPV6"
50 51
 
51 52
 
52 53
 # Saves significant environment variables to .stackenv for later use
... ...
@@ -578,13 +579,14 @@ function get_default_host_ip {
578 578
     local floating_range=$2
579 579
     local host_ip_iface=$3
580 580
     local host_ip=$4
581
+    local af=$5
581 582
 
582 583
     # Search for an IP unless an explicit is set by ``HOST_IP`` environment variable
583 584
     if [ -z "$host_ip" -o "$host_ip" == "dhcp" ]; then
584 585
         host_ip=""
585 586
         # Find the interface used for the default route
586
-        host_ip_iface=${host_ip_iface:-$(ip route | awk '/default/ {print $5}' | head -1)}
587
-        local host_ips=$(LC_ALL=C ip -f inet addr show ${host_ip_iface} | awk '/inet/ {split($2,parts,"/");  print parts[1]}')
587
+        host_ip_iface=${host_ip_iface:-$(ip -f $af route | awk '/default/ {print $5}' | head -1)}
588
+        local host_ips=$(LC_ALL=C ip -f $af addr show ${host_ip_iface} | awk /$af'/ {split($2,parts,"/");  print parts[1]}')
588 589
         local ip
589 590
         for ip in $host_ips; do
590 591
             # Attempt to filter out IP addresses that are part of the fixed and
... ...
@@ -593,6 +595,10 @@ function get_default_host_ip {
593 593
             # will be printed and the first IP from the interface will be used.
594 594
             # If that is not correct set ``HOST_IP`` in ``localrc`` to the correct
595 595
             # address.
596
+            if [[ "$af" == "inet6" ]]; then
597
+                host_ip=$ip
598
+                break;
599
+            fi
596 600
             if ! (address_in_net $ip $fixed_range || address_in_net $ip $floating_range); then
597 601
                 host_ip=$ip
598 602
                 break;
... ...
@@ -65,6 +65,7 @@ CINDER_SERVICE_HOST=${CINDER_SERVICE_HOST:-$SERVICE_HOST}
65 65
 CINDER_SERVICE_PORT=${CINDER_SERVICE_PORT:-8776}
66 66
 CINDER_SERVICE_PORT_INT=${CINDER_SERVICE_PORT_INT:-18776}
67 67
 CINDER_SERVICE_PROTOCOL=${CINDER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
68
+CINDER_SERVICE_LISTEN_ADDRESS=${CINDER_SERVICE_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
68 69
 
69 70
 # What type of LVM device should Cinder use for LVM backend
70 71
 # Defaults to default, which is thick, the other valid choice
... ...
@@ -222,6 +223,7 @@ function configure_cinder {
222 222
     iniset $CINDER_CONF DEFAULT api_paste_config $CINDER_API_PASTE_INI
223 223
     iniset $CINDER_CONF DEFAULT rootwrap_config "$CINDER_CONF_DIR/rootwrap.conf"
224 224
     iniset $CINDER_CONF DEFAULT osapi_volume_extension cinder.api.contrib.standard_extensions
225
+    iniset $CINDER_CONF DEFAULT osapi_volume_listen $CINDER_SERVICE_LISTEN_ADDRESS
225 226
     iniset $CINDER_CONF DEFAULT state_path $CINDER_STATE_PATH
226 227
     iniset $CINDER_CONF oslo_concurrency lock_path $CINDER_STATE_PATH
227 228
     iniset $CINDER_CONF DEFAULT periodic_interval $CINDER_PERIODIC_INTERVAL
... ...
@@ -70,10 +70,19 @@ function initialize_database_backends {
70 70
 
71 71
     # For backward-compatibility, read in the MYSQL_HOST/USER variables and use
72 72
     # them as the default values for the DATABASE_HOST/USER variables.
73
-    MYSQL_HOST=${MYSQL_HOST:-127.0.0.1}
73
+    MYSQL_HOST=${MYSQL_HOST:-$SERVICE_LOCAL_HOST}
74 74
     MYSQL_USER=${MYSQL_USER:-root}
75 75
 
76
-    DATABASE_HOST=${DATABASE_HOST:-${MYSQL_HOST}}
76
+    # Set DATABASE_HOST equal to MYSQL_HOST. If SERVICE_IP_VERSION is equal to 6,
77
+    # set DATABASE_HOST equal to [MYSQL_HOST]. MYSQL_HOST cannot use brackets due
78
+    # to mysql not using bracketing for IPv6 addresses. DATABASE_HOST must have brackets
79
+    # due to sqlalchemy only reading IPv6 addresses with brackets.
80
+    if [[ "$SERVICE_IP_VERSION" == 6 ]]; then
81
+        DATABASE_HOST=${DATABASE_HOST:-[$MYSQL_HOST]}
82
+    else
83
+        DATABASE_HOST=${DATABASE_HOST:-${MYSQL_HOST}}
84
+    fi
85
+
77 86
     DATABASE_USER=${DATABASE_USER:-${MYSQL_USER}}
78 87
 
79 88
     if [ -n "$MYSQL_PASSWORD" ]; then
... ...
@@ -90,10 +90,10 @@ function configure_database_mysql {
90 90
 
91 91
     # Now update ``my.cnf`` for some local needs and restart the mysql service
92 92
 
93
-    # Change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and
93
+    # Change ‘bind-address’ from localhost (127.0.0.1) to any (::) and
94 94
     # set default db type to InnoDB
95 95
     sudo bash -c "source $TOP_DIR/functions && \
96
-        iniset $my_conf mysqld bind-address 0.0.0.0 && \
96
+        iniset $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS" && \
97 97
         iniset $my_conf mysqld sql_mode STRICT_ALL_TABLES && \
98 98
         iniset $my_conf mysqld default-storage-engine InnoDB \
99 99
         iniset $my_conf mysqld max_connections 1024 \
... ...
@@ -64,6 +64,7 @@ fi
64 64
 
65 65
 # Glance connection info.  Note the port must be specified.
66 66
 GLANCE_SERVICE_HOST=${GLANCE_SERVICE_HOST:-$SERVICE_HOST}
67
+GLANCE_SERVICE_LISTEN_ADDRESS=${GLANCE_SERVICE_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
67 68
 GLANCE_SERVICE_PORT=${GLANCE_SERVICE_PORT:-9292}
68 69
 GLANCE_SERVICE_PORT_INT=${GLANCE_SERVICE_PORT_INT:-19292}
69 70
 GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$GLANCE_SERVICE_HOST:$GLANCE_SERVICE_PORT}
... ...
@@ -106,6 +107,7 @@ function configure_glance {
106 106
     # Copy over our glance configurations and update them
107 107
     cp $GLANCE_DIR/etc/glance-registry.conf $GLANCE_REGISTRY_CONF
108 108
     iniset $GLANCE_REGISTRY_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
109
+    iniset $GLANCE_REGISTRY_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
109 110
     inicomment $GLANCE_REGISTRY_CONF DEFAULT log_file
110 111
     local dburl=`database_connection_url glance`
111 112
     iniset $GLANCE_REGISTRY_CONF DEFAULT sql_connection $dburl
... ...
@@ -118,6 +120,7 @@ function configure_glance {
118 118
 
119 119
     cp $GLANCE_DIR/etc/glance-api.conf $GLANCE_API_CONF
120 120
     iniset $GLANCE_API_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
121
+    iniset $GLANCE_API_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
121 122
     inicomment $GLANCE_API_CONF DEFAULT log_file
122 123
     iniset $GLANCE_API_CONF DEFAULT sql_connection $dburl
123 124
     iniset $GLANCE_API_CONF DEFAULT use_syslog $SYSLOG
... ...
@@ -136,6 +139,7 @@ function configure_glance {
136 136
 
137 137
     # Store specific configs
138 138
     iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
139
+    iniset $GLANCE_API_CONF DEFAULT registry_host $GLANCE_SERVICE_HOST
139 140
 
140 141
     iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
141 142
 
... ...
@@ -202,6 +206,7 @@ function configure_glance {
202 202
     iniset $GLANCE_CACHE_CONF DEFAULT admin_user glance
203 203
     iniuncomment $GLANCE_CACHE_CONF DEFAULT auth_password
204 204
     iniset $GLANCE_CACHE_CONF DEFAULT admin_password $SERVICE_PASSWORD
205
+    iniset $GLANCE_CACHE_CONF DEFAULT registry_host $GLANCE_SERVICE_HOST
205 206
 
206 207
     # Store specific confs
207 208
     iniset $GLANCE_CACHE_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
... ...
@@ -223,6 +228,7 @@ function configure_glance {
223 223
     if is_service_enabled g-search; then
224 224
         cp $GLANCE_DIR/etc/glance-search.conf $GLANCE_SEARCH_CONF
225 225
         iniset $GLANCE_SEARCH_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
226
+        iniset $GLANCE_SEARCH_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
226 227
         inicomment $GLANCE_SEARCH_CONF DEFAULT log_file
227 228
         iniset $GLANCE_SEARCH_CONF DEFAULT use_syslog $SYSLOG
228 229
         iniset $GLANCE_SEARCH_CONF DEFAULT sql_connection $dburl
... ...
@@ -138,6 +138,8 @@ Q_PORT_INT=${Q_PORT_INT:-19696}
138 138
 Q_HOST=${Q_HOST:-$SERVICE_HOST}
139 139
 # Default protocol
140 140
 Q_PROTOCOL=${Q_PROTOCOL:-$SERVICE_PROTOCOL}
141
+# Default listen address
142
+Q_LISTEN_ADDRESS=${Q_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
141 143
 # Default admin username
142 144
 Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron}
143 145
 # Default auth strategy
... ...
@@ -871,6 +873,7 @@ function _configure_neutron_common {
871 871
     iniset $NEUTRON_CONF database connection `database_connection_url $Q_DB_NAME`
872 872
     iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron
873 873
     iniset $NEUTRON_CONF DEFAULT use_syslog $SYSLOG
874
+    iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
874 875
     # If addition config files are set, make sure their path name is set as well
875 876
     if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
876 877
         die $LINENO "Neutron additional plugin config not set.. exiting"
... ...
@@ -85,6 +85,8 @@ NOVA_SERVICE_HOST=${NOVA_SERVICE_HOST:-$SERVICE_HOST}
85 85
 NOVA_SERVICE_PORT=${NOVA_SERVICE_PORT:-8774}
86 86
 NOVA_SERVICE_PORT_INT=${NOVA_SERVICE_PORT_INT:-18774}
87 87
 NOVA_SERVICE_PROTOCOL=${NOVA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
88
+NOVA_SERVICE_LOCAL_HOST=${NOVA_SERVICE_LOCAL_HOST:-$SERVICE_LOCAL_HOST}
89
+NOVA_SERVICE_LISTEN_ADDRESS=${NOVA_SERVICE_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
88 90
 EC2_SERVICE_PORT=${EC2_SERVICE_PORT:-8773}
89 91
 EC2_SERVICE_PORT_INT=${EC2_SERVICE_PORT_INT:-18773}
90 92
 
... ...
@@ -482,11 +484,20 @@ function create_nova_conf {
482 482
     iniset $NOVA_CONF DEFAULT default_floating_pool "$PUBLIC_NETWORK_NAME"
483 483
     iniset $NOVA_CONF DEFAULT s3_host "$SERVICE_HOST"
484 484
     iniset $NOVA_CONF DEFAULT s3_port "$S3_SERVICE_PORT"
485
-    iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
485
+    if [[ $SERVICE_IP_VERSION == 6 ]]; then
486
+        iniset $NOVA_CONF DEFAULT my_ip "$HOST_IPV6"
487
+        iniset $NOVA_CONF DEFAULT use_ipv6 "True"
488
+    else
489
+        iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
490
+    fi
486 491
     iniset $NOVA_CONF database connection `database_connection_url nova`
487 492
     iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
488 493
     iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x"
489 494
     iniset $NOVA_CONF osapi_v3 enabled "True"
495
+    iniset $NOVA_CONF DEFAULT osapi_compute_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
496
+    iniset $NOVA_CONF DEFAULT ec2_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
497
+    iniset $NOVA_CONF DEFAULT metadata_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
498
+    iniset $NOVA_CONF DEFAULT s3_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
490 499
 
491 500
     if is_fedora || is_suse; then
492 501
         # nova defaults to /usr/local/bin, but fedora and suse pip like to
... ...
@@ -566,11 +577,13 @@ function create_nova_conf {
566 566
     if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
567 567
         # Address on which instance vncservers will listen on compute hosts.
568 568
         # For multi-host, this should be the management ip of the compute host.
569
-        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1}
570
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
569
+        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
570
+        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
571 571
         iniset $NOVA_CONF DEFAULT vnc_enabled true
572 572
         iniset $NOVA_CONF DEFAULT vncserver_listen "$VNCSERVER_LISTEN"
573 573
         iniset $NOVA_CONF DEFAULT vncserver_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
574
+        iniset $NOVA_CONF DEFAULT novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
575
+        iniset $NOVA_CONF DEFAULT xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
574 576
     else
575 577
         iniset $NOVA_CONF DEFAULT vnc_enabled false
576 578
     fi
... ...
@@ -578,11 +591,12 @@ function create_nova_conf {
578 578
     if is_service_enabled n-spice; then
579 579
         # Address on which instance spiceservers will listen on compute hosts.
580 580
         # For multi-host, this should be the management ip of the compute host.
581
-        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
582
-        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=127.0.0.1}
581
+        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
582
+        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
583 583
         iniset $NOVA_CONF spice enabled true
584 584
         iniset $NOVA_CONF spice server_listen "$SPICESERVER_LISTEN"
585 585
         iniset $NOVA_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
586
+        iniset $NOVA_CONF spice html5proxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
586 587
     else
587 588
         iniset $NOVA_CONF spice enabled false
588 589
     fi
... ...
@@ -622,6 +636,7 @@ function create_nova_conf {
622 622
     fi
623 623
 
624 624
     if is_service_enabled n-sproxy; then
625
+        iniset $NOVA_CONF serial_console serialproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
625 626
         iniset $NOVA_CONF serial_console enabled True
626 627
     fi
627 628
 }
... ...
@@ -45,6 +45,7 @@ SWIFT3_DIR=$DEST/swift3
45 45
 
46 46
 SWIFT_SERVICE_PROTOCOL=${SWIFT_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
47 47
 SWIFT_DEFAULT_BIND_PORT_INT=${SWIFT_DEFAULT_BIND_PORT_INT:-8081}
48
+SWIFT_SERVICE_LOCAL_HOST=${SWIFT_SERVICE_LOCAL_HOST:-$SERVICE_LOCAL_HOST}
48 49
 
49 50
 # TODO: add logging to different location.
50 51
 
... ...
@@ -668,9 +669,9 @@ function init_swift {
668 668
         swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
669 669
 
670 670
         for node_number in ${SWIFT_REPLICAS_SEQ}; do
671
-            swift-ring-builder object.builder add z${node_number}-127.0.0.1:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
672
-            swift-ring-builder container.builder add z${node_number}-127.0.0.1:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
673
-            swift-ring-builder account.builder add z${node_number}-127.0.0.1:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
671
+            swift-ring-builder object.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( OBJECT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
672
+            swift-ring-builder container.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( CONTAINER_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
673
+            swift-ring-builder account.builder add z${node_number}-${SWIFT_SERVICE_LOCAL_HOST}:$(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) ))/sdb1 1
674 674
         done
675 675
         swift-ring-builder object.builder rebalance
676 676
         swift-ring-builder container.builder rebalance
... ...
@@ -32,14 +32,15 @@ MYSQL_PASSWORD=stackdb
32 32
 RABBIT_PASSWORD=stackqueue
33 33
 SERVICE_PASSWORD=$ADMIN_PASSWORD
34 34
 
35
-# ``HOST_IP`` should be set manually for best results if the NIC configuration
36
-# of the host is unusual, i.e. ``eth1`` has the default route but ``eth0`` is the
37
-# public interface.  It is auto-detected in ``stack.sh`` but often is indeterminate
38
-# on later runs due to the IP moving from an Ethernet interface to a bridge on
39
-# the host. Setting it here also makes it available for ``openrc`` to include
40
-# when setting ``OS_AUTH_URL``.
41
-# ``HOST_IP`` is not set by default.
35
+# ``HOST_IP`` and ``HOST_IPV6`` should be set manually for best results if
36
+# the NIC configuration of the host is unusual, i.e. ``eth1`` has the default
37
+# route but ``eth0`` is the public interface.  They are auto-detected in
38
+# ``stack.sh`` but often is indeterminate on later runs due to the IP moving
39
+# from an Ethernet interface to a bridge on the host. Setting it here also
40
+# makes it available for ``openrc`` to include when setting ``OS_AUTH_URL``.
41
+# Neither is set by default.
42 42
 #HOST_IP=w.x.y.z
43
+#HOST_IPV6=2001:db8::7
43 44
 
44 45
 
45 46
 # Logging
... ...
@@ -1403,7 +1403,10 @@ fi
1403 1403
 echo ""
1404 1404
 echo ""
1405 1405
 echo ""
1406
-echo "This is your host ip: $HOST_IP"
1406
+echo "This is your host IP address: $HOST_IP"
1407
+if [ "$HOST_IPV6" != "" ]; then
1408
+    echo "This is your host IPv6 address: $HOST_IPV6"
1409
+fi
1407 1410
 
1408 1411
 # If you installed Horizon on this server you should be able
1409 1412
 # to access the site using your browser.
... ...
@@ -669,14 +669,54 @@ FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
669 669
 FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
670 670
 HOST_IP_IFACE=${HOST_IP_IFACE:-}
671 671
 HOST_IP=${HOST_IP:-}
672
+HOST_IPV6=${HOST_IPV6:-}
672 673
 
673
-HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP")
674
+HOST_IP=$(get_default_host_ip "$FIXED_RANGE" "$FLOATING_RANGE" "$HOST_IP_IFACE" "$HOST_IP" "inet")
674 675
 if [ "$HOST_IP" == "" ]; then
675 676
     die $LINENO "Could not determine host ip address.  See local.conf for suggestions on setting HOST_IP."
676 677
 fi
677 678
 
678
-# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
679
-SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
679
+HOST_IPV6=$(get_default_host_ip "" "" "$HOST_IP_IFACE" "$HOST_IPV6" "inet6")
680
+
681
+# SERVICE IP version
682
+# This is the IP version that services should be listening on, as well
683
+# as using to register their endpoints with keystone.
684
+SERVICE_IP_VERSION=${SERVICE_IP_VERSION:-4}
685
+
686
+# Validate SERVICE_IP_VERSION
687
+# It would be nice to support "4+6" here as well, but that will require
688
+# multiple calls into keystone to register endpoints, so for now let's
689
+# just support one or the other.
690
+if [[ $SERVICE_IP_VERSION != "4" ]] && [[ $SERVICE_IP_VERSION != "6" ]]; then
691
+    die $LINENO "SERVICE_IP_VERSION must be either 4 or 6"
692
+fi
693
+
694
+if [[ "$SERVICE_IP_VERSION" == 4 ]]; then
695
+    DEF_SERVICE_HOST=$HOST_IP
696
+    DEF_SERVICE_LOCAL_HOST=127.0.0.1
697
+    DEF_SERVICE_LISTEN_ADDRESS=0.0.0.0
698
+fi
699
+
700
+if [[ "$SERVICE_IP_VERSION" == 6 ]]; then
701
+    if [ "$HOST_IPV6" == "" ]; then
702
+        die $LINENO "Could not determine host IPv6 address.  See local.conf for suggestions on setting HOST_IPV6."
703
+    fi
704
+
705
+    DEF_SERVICE_HOST=[$HOST_IPV6]
706
+    DEF_SERVICE_LOCAL_HOST=::1
707
+    DEF_SERVICE_LISTEN_ADDRESS=::
708
+fi
709
+
710
+# This is either 0.0.0.0 for IPv4 or :: for IPv6
711
+SERVICE_LISTEN_ADDRESS=${SERVICE_LISTEN_ADDRESS:-${DEF_SERVICE_LISTEN_ADDRESS}}
712
+
713
+# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for
714
+# service endpoints.  Default is dependent on SERVICE_IP_VERSION above.
715
+SERVICE_HOST=${SERVICE_HOST:-${DEF_SERVICE_HOST}}
716
+# This is either 127.0.0.1 for IPv4 or ::1 for IPv6
717
+SERVICE_LOCAL_HOST=${SERVICE_LOCAL_HOST:-${DEF_SERVICE_LOCAL_HOST}}
718
+
719
+REGION_NAME=${REGION_NAME:-RegionOne}
680 720
 
681 721
 # Configure services to use syslog instead of writing to individual log files
682 722
 SYSLOG=$(trueorfalse False SYSLOG)