From 9297319fdb18440b7f37aa71b12a7599cd691dbb Mon Sep 17 00:00:00 2001 From: Paul Michali Date: Mon, 24 Jun 2013 12:44:58 -0700 Subject: [PATCH] Enhance DevStack to allow user to specify the following customizations for the predefined networks created on startup (default in parenthesis): PRIVATE_SUBNET_NAME - Name of the local subnet (private-subnet) PUBLIC_SUBNET_NAME - Name of the public subnet (public-subnet) PUBLIC_NETWORK_GATEWAY - IP for the public subnet (172.24.4.225) Moved NETWORK_GATEWAY into lib/quantum, along with these new customizations. bug 1194218 Change-Id: I87ebc22e338df278db7523f11be07de1ca88234b --- lib/quantum | 12 +++++++++--- stack.sh | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/quantum b/lib/quantum index f16937c684..afe99c48cb 100644 --- a/lib/quantum +++ b/lib/quantum @@ -65,6 +65,12 @@ set +o xtrace # Quantum Network Configuration # ----------------------------- +# Gateway and subnet defaults, in case they are not customized in localrc +NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} +PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.225} +PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"} +PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"} + # Set up default directories QUANTUM_DIR=$DEST/quantum QUANTUMCLIENT_DIR=$DEST/python-quantumclient @@ -304,11 +310,11 @@ function create_quantum_initial_network() { sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE done NET_ID=$(quantum net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2) - SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) + SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) sudo ifconfig $OVS_PHYSICAL_BRIDGE up else NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2) - SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) + SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) fi if [[ "$Q_L3_ENABLED" == "True" ]]; then @@ -323,7 +329,7 @@ function create_quantum_initial_network() { quantum router-interface-add $ROUTER_ID $SUBNET_ID # Create an external network, and a subnet. Configure the external network as router gw EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2) - 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) + EXT_GW_IP=$(quantum subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $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_service_enabled q-l3; then diff --git a/stack.sh b/stack.sh index 5372942855..57b8529e06 100755 --- a/stack.sh +++ b/stack.sh @@ -266,7 +266,6 @@ sudo chown -R $STACK_USER $DATA_DIR FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.224/28} FIXED_RANGE=${FIXED_RANGE:-10.0.0.0/24} FIXED_NETWORK_SIZE=${FIXED_NETWORK_SIZE:-256} -NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} HOST_IP=$(get_default_host_ip $FIXED_RANGE $FLOATING_RANGE "$HOST_IP_IFACE" "$HOST_IP") if [ "$HOST_IP" == "" ]; then