Devstack support for nicira plugin
Bug 1116847
Includes slight refactoring of L3 logic in main lib/quantum as previous
logic treated l3-agent as only way to do L3, whereas NVP has its own L3
support.
Change-Id: Ifd8c6864add5939432b544285cf027e52329dea2
diff --git a/lib/quantum b/lib/quantum
index daf945a..0fef1ae 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -284,14 +284,13 @@
SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
fi
- if is_service_enabled q-l3; then
+ if [[ "$Q_L3_ENABLED" == "True" ]]; then
# Create a router, and add the private subnet as one of its interfaces
- if [[ "$Q_USE_NAMESPACE" == "True" ]]; then
- # If namespaces are enabled, create a tenant-owned router.
+ if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
+ # create a tenant-owned router.
ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2)
else
- # If namespaces are disabled, the L3 agent can only target
- # a single router, which should not be tenant-owned.
+ # Plugin only supports creating a single router, which should be admin owned.
ROUTER_ID=$(quantum router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
fi
quantum router-interface-add $ROUTER_ID $SUBNET_ID
@@ -300,16 +299,19 @@
EXT_GW_IP=$(quantum subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
quantum router-gateway-set $ROUTER_ID $EXT_NET_ID
- if is_quantum_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
- CIDR_LEN=${FLOATING_RANGE#*/}
- sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
- sudo ip link set $PUBLIC_BRIDGE up
- ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
- sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
- fi
- if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
- # Explicitly set router id in l3 agent configuration
- iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
+ if is_service_enabled q-l3; then
+ # logic is specific to using the l3-agent for l3
+ if is_quantum_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
+ CIDR_LEN=${FLOATING_RANGE#*/}
+ sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
+ sudo ip link set $PUBLIC_BRIDGE up
+ ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
+ sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
+ fi
+ if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
+ # Explicitly set router id in l3 agent configuration
+ iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
+ fi
fi
fi
}
@@ -450,6 +452,9 @@
}
function _configure_quantum_l3_agent() {
+ Q_L3_ENABLED=True
+ # for l3-agent, only use per tenant router if we have namespaces
+ Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent"
PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini