Browse code

Allow specification of SERVICE_HOST in localrc. This is most immediately useful for aio integration tests, since the access to the public_ip can be unstable in such configurations.

Change-Id: I4864179a64dbc2694bafa8d82280b9859e466b4b

Anthony Young authored on 2011/12/22 03:09:05
Showing 3 changed files
... ...
@@ -33,10 +33,10 @@ $BIN_DIR/keystone-manage $* service add keystone identity "Keystone Identity Ser
33 33
 $BIN_DIR/keystone-manage $* service add swift object-store "Swift Service"
34 34
 
35 35
 #endpointTemplates
36
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id%  http://%HOST_IP%:8774/v1.1/%tenant_id% 1 1
37
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% 1 1
38
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne keystone http://%HOST_IP%:5000/v2.0 http://%HOST_IP%:35357/v2.0 http://%HOST_IP%:5000/v2.0 1 1
39
-$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1
36
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%SERVICE_HOST%:8774/v1.1/%tenant_id% http://%SERVICE_HOST%:8774/v1.1/%tenant_id%  http://%SERVICE_HOST%:8774/v1.1/%tenant_id% 1 1
37
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%SERVICE_HOST%:9292/v1.1/%tenant_id% http://%SERVICE_HOST%:9292/v1.1/%tenant_id% http://%SERVICE_HOST%:9292/v1.1/%tenant_id% 1 1
38
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne keystone http://%SERVICE_HOST%:5000/v2.0 http://%SERVICE_HOST%:35357/v2.0 http://%SERVICE_HOST%:5000/v2.0 1 1
39
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%SERVICE_HOST%:8080/v1/AUTH_%tenant_id% http://%SERVICE_HOST%:8080/ http://%SERVICE_HOST%:8080/v1/AUTH_%tenant_id% 1 1
40 40
 
41 41
 # Tokens
42 42
 $BIN_DIR/keystone-manage $* token add %SERVICE_TOKEN% admin admin 2015-02-05T00:00
... ...
@@ -3,8 +3,9 @@
3 3
 # Load local configuration
4 4
 source ./stackrc
5 5
 
6
-# Set api host endpoint
6
+# Set api host endpoint, defaulting to HOST_IP but allowing override by SERVICE_HOST
7 7
 HOST_IP=${HOST_IP:-127.0.0.1}
8
+SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
8 9
 
9 10
 # Nova original used project_id as the *account* that owned resources (servers,
10 11
 # ip address, ...)   With the addition of Keystone we have standardized on the
... ...
@@ -29,7 +30,7 @@ export NOVA_PASSWORD=${ADMIN_PASSWORD:-secrete}
29 29
 #
30 30
 # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0.  We
31 31
 # will use the 1.1 *compute api*
32
-export NOVA_URL=${NOVA_URL:-http://$HOST_IP:5000/v2.0/}
32
+export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0/}
33 33
 
34 34
 # Currently novaclient needs you to specify the *compute api* version.  This
35 35
 # needs to match the config of your catalog returned by Keystone.
... ...
@@ -39,7 +40,7 @@ export NOVA_VERSION=${NOVA_VERSION:-1.1}
39 39
 export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne}
40 40
 
41 41
 # Set the ec2 url so euca2ools works
42
-export EC2_URL=${EC2_URL:-http://$HOST_IP:8773/services/Cloud}
42
+export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud}
43 43
 
44 44
 # Access key is set in the initial keystone data to be the same as username
45 45
 export EC2_ACCESS_KEY=${USERNAME:-demo}
... ...
@@ -232,12 +232,14 @@ function read_password {
232 232
 # FIXME: more documentation about why these are important flags.  Also
233 233
 # we should make sure we use the same variable names as the flag names.
234 234
 
235
+# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
236
+SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
235 237
 PUBLIC_INTERFACE=${PUBLIC_INTERFACE:-eth0}
236 238
 FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
237 239
 FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
238 240
 FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28}
239 241
 NET_MAN=${NET_MAN:-FlatDHCPManager}
240
-EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP}
242
+EC2_DMZ_HOST=${EC2_DMZ_HOST:-$SERVICE_HOST}
241 243
 FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-br100}
242 244
 VLAN_INTERFACE=${VLAN_INTERFACE:-$PUBLIC_INTERFACE}
243 245
 
... ...
@@ -299,7 +301,7 @@ RABBIT_HOST=${RABBIT_HOST:-localhost}
299 299
 read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
300 300
 
301 301
 # Glance connection info.  Note the port must be specified.
302
-GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
302
+GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
303 303
 
304 304
 # SWIFT
305 305
 # -----
... ...
@@ -937,7 +939,7 @@ if [[ "$ENABLED_SERVICES" =~ "openstackx" ]]; then
937 937
     add_nova_flag "--osapi_extensions_path=$OPENSTACKX_DIR/extensions"
938 938
 fi
939 939
 if [[ "$ENABLED_SERVICES" =~ "n-vnc" ]]; then
940
-    add_nova_flag "--vncproxy_url=http://$HOST_IP:6080"
940
+    add_nova_flag "--vncproxy_url=http://$SERVICE_HOST:6080"
941 941
     add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
942 942
 fi
943 943
 add_nova_flag "--api_paste_config=$NOVA_DIR/bin/nova-api-paste.ini"
... ...
@@ -1017,7 +1019,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1017 1017
     # keystone_data.sh creates our admin user and our ``SERVICE_TOKEN``.
1018 1018
     KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh
1019 1019
     cp $FILES/keystone_data.sh $KEYSTONE_DATA
1020
-    sudo sed -e "s,%HOST_IP%,$HOST_IP,g" -i $KEYSTONE_DATA
1020
+    sudo sed -e "s,%SERVICE_HOST%,$SERVICE_HOST,g" -i $KEYSTONE_DATA
1021 1021
     sudo sed -e "s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g" -i $KEYSTONE_DATA
1022 1022
     sudo sed -e "s,%ADMIN_PASSWORD%,$ADMIN_PASSWORD,g" -i $KEYSTONE_DATA
1023 1023
     # initialize keystone with default users/endpoints
... ...
@@ -1229,12 +1231,12 @@ echo ""
1229 1229
 # If you installed the horizon on this server, then you should be able
1230 1230
 # to access the site using your browser.
1231 1231
 if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
1232
-    echo "horizon is now available at http://$HOST_IP/"
1232
+    echo "horizon is now available at http://$SERVICE_HOST/"
1233 1233
 fi
1234 1234
 
1235 1235
 # If keystone is present, you can point nova cli to this server
1236 1236
 if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1237
-    echo "keystone is serving at http://$HOST_IP:5000/v2.0/"
1237
+    echo "keystone is serving at http://$SERVICE_HOST:5000/v2.0/"
1238 1238
     echo "examples on using novaclient command line is in exercise.sh"
1239 1239
     echo "the default users are: admin and demo"
1240 1240
     echo "the password: $ADMIN_PASSWORD"