Browse code

update quantum setup to automatically add route to fixed_range

- allows metadata service to work out of the box for VMs in fixed_range
- allows direct access to VMs via their fixed_ips from the devstack host.

Change-Id: I24da91fdf184e195185462554c044ee6f65d58ce

Dan Wendlandt authored on 2012/09/26 17:04:55
Showing 1 changed files
... ...
@@ -359,7 +359,7 @@ Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
359 359
 Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
360 360
 Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP=:-True}
361 361
 # Meta data IP
362
-Q_META_DATA_IP=${Q_META_DATA_IP:-}
362
+Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
363 363
 
364 364
 # Name of the LVM volume group to use/create for iscsi volumes
365 365
 VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
... ...
@@ -2216,10 +2216,12 @@ if is_service_enabled q-svc; then
2216 2216
         EXT_NET_ID=$(quantum net-create ext_net -- --router:external=True | grep ' id ' | get_field 2)
2217 2217
         EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
2218 2218
         quantum router-gateway-set $ROUTER_ID $EXT_NET_ID
2219
-        if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
2219
+        if [[ "$Q_PLUGIN" = "openvswitch" ]] && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
2220 2220
             CIDR_LEN=${FLOATING_RANGE#*/}
2221 2221
             sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
2222 2222
             sudo ip link set $PUBLIC_BRIDGE up
2223
+            ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
2224
+            sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
2223 2225
         fi
2224 2226
         if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
2225 2227
             # Explicitly set router id in l3 agent configuration