Browse code

Improve quantum l3 and tempest config.

* Previously, configuration for the q-l3 agent was creating a
tenant-owned router. This change maintains that behaviour if
namespaces are enabled, but creates a public (not tenant-owned)
router if namespaces are disabled. Since the L3 agent can only
manage a single router if namespaces are disabled, the change
ensures that the single router can be shared by multiple tenants.
* Add tempest configuration for the public router.

Change-Id: I2878a7eb9797bfd71082a55d4773519dc5198abc

Maru Newby authored on 2012/12/19 12:59:20
Showing 2 changed files
... ...
@@ -92,6 +92,8 @@ Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
92 92
 Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-False}
93 93
 # Use quantum-debug command
94 94
 Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
95
+# The name of the default q-l3 router
96
+Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1}
95 97
 
96 98
 if is_service_enabled quantum; then
97 99
     Q_RR_CONF_FILE=$QUANTUM_CONF_DIR/rootwrap.conf
... ...
@@ -277,7 +279,14 @@ function create_quantum_initial_network() {
277 277
 
278 278
     if is_service_enabled q-l3; then
279 279
         # Create a router, and add the private subnet as one of its interfaces
280
-        ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2)
280
+        if [[ "$Q_USE_NAMESPACE" == "True" ]]; then
281
+            # If namespaces are enabled, create a tenant-owned router.
282
+            ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2)
283
+        else
284
+            # If namespaces are disabled, the L3 agent can only target
285
+            # a single router, which should not be tenant-owned.
286
+            ROUTER_ID=$(quantum router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
287
+        fi
281 288
         quantum router-interface-add $ROUTER_ID $SUBNET_ID
282 289
         # Create an external network, and a subnet. Configure the external network as router gw
283 290
         EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
... ...
@@ -11,6 +11,9 @@
11 11
 # - ``S3_SERVICE_PORT``
12 12
 # - ``SERVICE_HOST``
13 13
 # - ``BASE_SQL_CONN`` ``lib/database`` declares
14
+# - ``PUBLIC_NETWORK_NAME``
15
+# - ``Q_USE_NAMESPACE``
16
+# - ``Q_ROUTER_NAME``
14 17
 # Optional Dependencies:
15 18
 # IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH
16 19
 # ALT_* (similar vars exists in keystone_data.sh)
... ...
@@ -61,6 +64,7 @@ function configure_tempest() {
61 61
     local flavors_ref
62 62
     local flavor_lines
63 63
     local public_network_id
64
+    local public_router_id
64 65
     local tenant_networks_reachable
65 66
 
66 67
     # TODO(afazekas):
... ...
@@ -175,6 +179,12 @@ function configure_tempest() {
175 175
     if is_service_enabled q-l3; then
176 176
         public_network_id=$(quantum net-list | grep $PUBLIC_NETWORK_NAME | \
177 177
             awk '{print $2}')
178
+        if [ "$Q_USE_NAMESPACE" == "False" ]; then
179
+            # If namespaces are disabled, devstack will create a single
180
+            # public router that tempest should be configured to use.
181
+            public_router_id=$(quantum router-list | awk "/ $Q_ROUTER_NAME / \
182
+               { print \$2 }")
183
+        fi
178 184
     fi
179 185
 
180 186
     # Timeouts
... ...
@@ -243,6 +253,7 @@ function configure_tempest() {
243 243
     iniset $TEMPEST_CONF network password "$password"
244 244
     iniset $TEMPEST_CONF network tenant_networks_reachable "$tenant_networks_reachable"
245 245
     iniset $TEMPEST_CONF network public_network_id "$public_network_id"
246
+    iniset $TEMPEST_CONF network public_router_id "$public_router_id"
246 247
 
247 248
     #boto
248 249
     iniset $TEMPEST_CONF boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"