Assumes devstack was configured with SERVICE_IP_VERSION in
local.conf
SERVICE_IP_VERSION is stored in .stackenv and checked in
openrc. If SERVICE_IP_VERSION is set to 6, openrc will use
IPv6.
NOTE: At first, I added a '-6' option to the openrc call
which would set the HOSTS accordingly. I then simplified
the code by saving SERVICE_IP_VERSION to the .stackenv file
which is sourced by openrc. After that, I simplified the
code even more by removing an extra, unnecessary, variable.
Change-Id: I5d46d5438d3e56fea788720ca17f0010caef3df1
... | ... |
@@ -47,7 +47,7 @@ TRACK_DEPENDS=${TRACK_DEPENDS:-False} |
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 | 49 |
LOGFILE OS_CACERT SERVICE_HOST SERVICE_PROTOCOL STACK_USER TLS_IP \ |
50 |
- HOST_IPV6" |
|
50 |
+ HOST_IPV6 SERVICE_IP_VERSION" |
|
51 | 51 |
|
52 | 52 |
|
53 | 53 |
# Saves significant environment variables to .stackenv for later use |
... | ... |
@@ -56,18 +56,26 @@ export OS_NO_CACHE=${OS_NO_CACHE:-1} |
56 | 56 |
# Region |
57 | 57 |
export OS_REGION_NAME=${REGION_NAME:-RegionOne} |
58 | 58 |
|
59 |
-# Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint, |
|
60 |
-# which is convenient for some localrc configurations. |
|
61 |
-HOST_IP=${HOST_IP:-127.0.0.1} |
|
62 |
-SERVICE_HOST=${SERVICE_HOST:-$HOST_IP} |
|
59 |
+# Set the host API endpoint. This will default to HOST_IP if SERVICE_IP_VERSION |
|
60 |
+# is 4, else HOST_IPV6 if it's 6. SERVICE_HOST may also be used to specify the |
|
61 |
+# endpoint, which is convenient for some localrc configurations. Additionally, |
|
62 |
+# some exercises call Glance directly. On a single-node installation, Glance |
|
63 |
+# should be listening on a local IP address, depending on the setting of |
|
64 |
+# SERVICE_IP_VERSION. If its running elsewhere, it can be set here. |
|
65 |
+if [[ $SERVICE_IP_VERSION == 6 ]]; then |
|
66 |
+ HOST_IPV6=${HOST_IPV6:-::1} |
|
67 |
+ SERVICE_HOST=${SERVICE_HOST:-[$HOST_IPV6]} |
|
68 |
+ GLANCE_HOST=${GLANCE_HOST:-[$HOST_IPV6]} |
|
69 |
+else |
|
70 |
+ HOST_IP=${HOST_IP:-127.0.0.1} |
|
71 |
+ SERVICE_HOST=${SERVICE_HOST:-$HOST_IP} |
|
72 |
+ GLANCE_HOST=${GLANCE_HOST:-$HOST_IP} |
|
73 |
+fi |
|
74 |
+ |
|
63 | 75 |
SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http} |
64 | 76 |
KEYSTONE_AUTH_PROTOCOL=${KEYSTONE_AUTH_PROTOCOL:-$SERVICE_PROTOCOL} |
65 | 77 |
KEYSTONE_AUTH_HOST=${KEYSTONE_AUTH_HOST:-$SERVICE_HOST} |
66 | 78 |
|
67 |
-# Some exercises call glance directly. On a single-node installation, Glance |
|
68 |
-# should be listening on HOST_IP. If its running elsewhere, it can be set here |
|
69 |
-GLANCE_HOST=${GLANCE_HOST:-$HOST_IP} |
|
70 |
- |
|
71 | 79 |
# Identity API version |
72 | 80 |
export OS_IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0} |
73 | 81 |
|