Browse code

Merge "Port work on SERVICE_HOST from stable/diablo. Allows user to specify service endpoint host separately from HOST_IP"

Jenkins authored on 2011/12/31 03:25:22
Showing 3 changed files
... ...
@@ -36,12 +36,12 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
36 36
 fi
37 37
 
38 38
 #endpointTemplates
39
-$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
40
-$BIN_DIR/keystone-manage endpointTemplates add RegionOne ec2 http://%HOST_IP%:8773/services/Cloud http://%HOST_IP%:8773/services/Admin http://%HOST_IP%:8773/services/Cloud 1 1
41
-$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
42
-$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 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
40
+$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne ec2 http://%SERVICE_HOST%:8773/services/Cloud http://%SERVICE_HOST%:8773/services/Admin http://%SERVICE_HOST%:8773/services/Cloud 1 1
41
+$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
42
+$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
43 43
 if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
44
-    $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
44
+    $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
45 45
 fi
46 46
 
47 47
 # Tokens
... ...
@@ -3,8 +3,10 @@
3 3
 # Load local configuration
4 4
 source ./stackrc
5 5
 
6
-# Set api host endpoint
6
+# Set api HOST_IP endpoint.  SERVICE_HOST may also be used to specify the endpoint,
7
+# which is convenient for some localrc configurations.
7 8
 HOST_IP=${HOST_IP:-127.0.0.1}
9
+SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
8 10
 
9 11
 # Nova original used project_id as the *account* that owned resources (servers,
10 12
 # ip address, ...)   With the addition of Keystone we have standardized on the
... ...
@@ -29,7 +31,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 +41,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}
... ...
@@ -215,6 +215,9 @@ if [ ! -n "$HOST_IP" ]; then
215 215
     fi
216 216
 fi
217 217
 
218
+# Allow the use of an alternate hostname (such as localhost/127.0.0.1) for service endpoints.
219
+SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
220
+
218 221
 # Configure services to syslog instead of writing to individual log files
219 222
 SYSLOG=`trueorfalse False $SYSLOG`
220 223
 SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
... ...
@@ -271,7 +274,7 @@ FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24}
271 271
 FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256}
272 272
 FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28}
273 273
 NET_MAN=${NET_MAN:-FlatDHCPManager}
274
-EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP}
274
+EC2_DMZ_HOST=${EC2_DMZ_HOST:-$SERVICE_HOST}
275 275
 FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-br100}
276 276
 VLAN_INTERFACE=${VLAN_INTERFACE:-$PUBLIC_INTERFACE}
277 277
 
... ...
@@ -334,7 +337,7 @@ RABBIT_HOST=${RABBIT_HOST:-localhost}
334 334
 read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
335 335
 
336 336
 # Glance connection info.  Note the port must be specified.
337
-GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
337
+GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
338 338
 
339 339
 # SWIFT
340 340
 # -----
... ...
@@ -1064,7 +1067,7 @@ if [[ "$ENABLED_SERVICES" =~ "openstackx" ]]; then
1064 1064
     add_nova_flag "--osapi_extension=extensions.admin.Admin"
1065 1065
 fi
1066 1066
 if [[ "$ENABLED_SERVICES" =~ "n-vnc" ]]; then
1067
-    VNCPROXY_URL=${VNCPROXY_URL:-"http://$HOST_IP:6080"}
1067
+    VNCPROXY_URL=${VNCPROXY_URL:-"http://$SERVICE_HOST:6080"}
1068 1068
     add_nova_flag "--vncproxy_url=$VNCPROXY_URL"
1069 1069
     add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
1070 1070
 fi
... ...
@@ -1145,7 +1148,7 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1145 1145
     # keystone_data.sh creates our admin user and our ``SERVICE_TOKEN``.
1146 1146
     KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh
1147 1147
     cp $FILES/keystone_data.sh $KEYSTONE_DATA
1148
-    sudo sed -e "s,%HOST_IP%,$HOST_IP,g" -i $KEYSTONE_DATA
1148
+    sudo sed -e "s,%SERVICE_HOST%,$SERVICE_HOST,g" -i $KEYSTONE_DATA
1149 1149
     sudo sed -e "s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g" -i $KEYSTONE_DATA
1150 1150
     sudo sed -e "s,%ADMIN_PASSWORD%,$ADMIN_PASSWORD,g" -i $KEYSTONE_DATA
1151 1151
     # initialize keystone with default users/endpoints
... ...
@@ -1402,18 +1405,21 @@ echo ""
1402 1402
 # If you installed the horizon on this server, then you should be able
1403 1403
 # to access the site using your browser.
1404 1404
 if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
1405
-    echo "horizon is now available at http://$HOST_IP/"
1405
+    echo "horizon is now available at http://$SERVICE_HOST/"
1406 1406
 fi
1407 1407
 
1408 1408
 # If keystone is present, you can point nova cli to this server
1409 1409
 if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1410
-    echo "keystone is serving at http://$HOST_IP:5000/v2.0/"
1410
+    echo "keystone is serving at http://$SERVICE_HOST:5000/v2.0/"
1411 1411
     echo "examples on using novaclient command line is in exercise.sh"
1412 1412
     echo "the default users are: admin and demo"
1413 1413
     echo "the password: $ADMIN_PASSWORD"
1414 1414
 fi
1415 1415
 
1416
-# indicate how long this took to run (bash maintained variable 'SECONDS')
1416
+# Echo HOST_IP - useful for build_uec.sh, which uses dhcp to give the instance an address
1417
+echo "This is your host ip: $HOST_IP"
1418
+
1419
+# Indicate how long this took to run (bash maintained variable 'SECONDS')
1417 1420
 echo "stack.sh completed in $SECONDS seconds."
1418 1421
 
1419 1422
 ) | tee -a "$LOGFILE"