Browse code

Add IPv6 support to devstack infrastructure

By default, most Openstack services are bound to 0.0.0.0
and service endpoints are registered as IPv4 addresses.
With this change we introduce two new variables to control
this behavior:

SERVICE_IP_VERSION - can either be "4" or "6".

When set to "4" (default if not set) devstack will operate
as today - most services will open listen sockets on 0.0.0.0
and service endpoints will be registered using HOST_IP as the
address.

When set to "6" devstack services will open listen sockets on ::
and service endpoints will be registered using HOST_IPV6 as the
address.

There is no support for "4+6", more work is required for that.

HOST_IPV6 - if SERVICE_IP_VERSION=6 this must be an IPv6
address configured on the system.

Some existing services, like the Openvswitch agent, will continue
to use IPv4 addresses for things like tunnel endpoints. This is
a current restriction in the code and can be updated at a later
time. This change is just a first step to supporting IPv6-only
control and data planes in devstack.

This change is also partly based on two previous patches,
https://review.openstack.org/#/c/140519/ and
https://review.openstack.org/#/c/176898/

Change-Id: I5c0b775490ce54ab104fd5e89b20fb700212ae74
Co-Authored-By: Sean Collins <sean@coreitpro.com>
Co-Authored-By: Baodong Li <baoli@cisco.com>
Co-Authored-By: Sridhar Gaddam <sridhar.gaddam@enovance.com>
Co-Authored-By: Adam Kacmarsky <adam.kacmarsky@hp.com>
Co-Authored-By: Jeremy Alvis <jeremy.alvis@hp.com>

Brian Haley authored on 2015/06/17 02:14:31
Showing 13 changed files
... ...
@@ -360,6 +360,22 @@ Be aware that there are some features currently missing in cells, one notable
360 360
 one being security groups.  The exercises have been patched to disable
361 361
 functionality not supported by cells.
362 362
 
363
+# IPv6
364
+
365
+By default, most Openstack services are bound to 0.0.0.0
366
+and service endpoints are registered as IPv4 addresses.
367
+A new variable was created to control this behavior, and to
368
+allow for operation over IPv6 instead of IPv4.
369
+
370
+For this, add the following to `local.conf`:
371
+
372
+    SERVICE_IP_VERSION=6
373
+
374
+When set to "6" devstack services will open listen sockets on ::
375
+and service endpoints will be registered using HOST_IPV6 as the
376
+address.  The default value for this setting is `4`.  Dual-mode
377
+support, for example `4+6` is not currently supported.
378
+
363 379
 
364 380
 # Local Configuration
365 381
 
... ...
@@ -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
 
... ...
@@ -476,11 +478,20 @@ function create_nova_conf {
476 476
     iniset $NOVA_CONF DEFAULT default_floating_pool "$PUBLIC_NETWORK_NAME"
477 477
     iniset $NOVA_CONF DEFAULT s3_host "$SERVICE_HOST"
478 478
     iniset $NOVA_CONF DEFAULT s3_port "$S3_SERVICE_PORT"
479
-    iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
479
+    if [[ $SERVICE_IP_VERSION == 6 ]]; then
480
+        iniset $NOVA_CONF DEFAULT my_ip "$HOST_IPV6"
481
+        iniset $NOVA_CONF DEFAULT use_ipv6 "True"
482
+    else
483
+        iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
484
+    fi
480 485
     iniset $NOVA_CONF database connection `database_connection_url nova`
481 486
     iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
482 487
     iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x"
483 488
     iniset $NOVA_CONF osapi_v3 enabled "True"
489
+    iniset $NOVA_CONF DEFAULT osapi_compute_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
490
+    iniset $NOVA_CONF DEFAULT ec2_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
491
+    iniset $NOVA_CONF DEFAULT metadata_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
492
+    iniset $NOVA_CONF DEFAULT s3_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
484 493
 
485 494
     if is_fedora || is_suse; then
486 495
         # nova defaults to /usr/local/bin, but fedora and suse pip like to
... ...
@@ -560,11 +571,13 @@ function create_nova_conf {
560 560
     if is_service_enabled n-novnc || is_service_enabled n-xvnc || [ "$NOVA_VNC_ENABLED" != False ]; then
561 561
         # Address on which instance vncservers will listen on compute hosts.
562 562
         # For multi-host, this should be the management ip of the compute host.
563
-        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1}
564
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
563
+        VNCSERVER_LISTEN=${VNCSERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
564
+        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
565 565
         iniset $NOVA_CONF DEFAULT vnc_enabled true
566 566
         iniset $NOVA_CONF DEFAULT vncserver_listen "$VNCSERVER_LISTEN"
567 567
         iniset $NOVA_CONF DEFAULT vncserver_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
568
+        iniset $NOVA_CONF DEFAULT novncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
569
+        iniset $NOVA_CONF DEFAULT xvpvncproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
568 570
     else
569 571
         iniset $NOVA_CONF DEFAULT vnc_enabled false
570 572
     fi
... ...
@@ -572,11 +585,12 @@ function create_nova_conf {
572 572
     if is_service_enabled n-spice; then
573 573
         # Address on which instance spiceservers will listen on compute hosts.
574 574
         # For multi-host, this should be the management ip of the compute host.
575
-        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
576
-        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=127.0.0.1}
575
+        SPICESERVER_PROXYCLIENT_ADDRESS=${SPICESERVER_PROXYCLIENT_ADDRESS=$NOVA_SERVICE_LOCAL_HOST}
576
+        SPICESERVER_LISTEN=${SPICESERVER_LISTEN=$NOVA_SERVICE_LOCAL_HOST}
577 577
         iniset $NOVA_CONF spice enabled true
578 578
         iniset $NOVA_CONF spice server_listen "$SPICESERVER_LISTEN"
579 579
         iniset $NOVA_CONF spice server_proxyclient_address "$SPICESERVER_PROXYCLIENT_ADDRESS"
580
+        iniset $NOVA_CONF spice html5proxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
580 581
     else
581 582
         iniset $NOVA_CONF spice enabled false
582 583
     fi
... ...
@@ -616,6 +630,7 @@ function create_nova_conf {
616 616
     fi
617 617
 
618 618
     if is_service_enabled n-sproxy; then
619
+        iniset $NOVA_CONF serial_console serialproxy_host "$NOVA_SERVICE_LISTEN_ADDRESS"
619 620
         iniset $NOVA_CONF serial_console enabled True
620 621
     fi
621 622
 }
... ...
@@ -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)