Browse code

Fix stack failure when default subnetpool is set

Currently stack.sh will fail if a value is set for
default_ipv4_subnet_pool and/or default_ipv6_subnet_pool in
neutron.conf. This is because setting either of these values
overrides the default behaviour of using the implicit (none)
subnetpool for subnet creation, and the subnetpools
specified in neutron.conf have not been created at the time
of the devstack calls to subnet-create.

This patch fixes the failure by specifying subnetpool = None
in calls to subnet-create, so that neutron will behave as
devstack expects. This parameter will no longer be required
once these configuration options are removed in the OpenStack
N release, but will be required for compatibility with Kilo,
Liberty, and Mitaka.

Change-Id: I29b2d62a022b43f6623b127af2ca303f9de847b0
Closes-Bug: #1472200

John Davidge authored on 2015/07/07 19:10:54
Showing 2 changed files
... ...
@@ -235,7 +235,7 @@ function create_network {
235 235
     local NET_ID
236 236
     NET_ID=$(neutron net-create --tenant-id $TENANT_ID $NET_NAME $EXTRA| grep ' id ' | awk '{print $4}' )
237 237
     die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $TENANT_ID $NET_NAME $EXTRA"
238
-    neutron subnet-create --ip-version 4 --tenant-id $TENANT_ID --gateway $GATEWAY $NET_ID $CIDR
238
+    neutron subnet-create --ip-version 4 --tenant-id $TENANT_ID --gateway $GATEWAY --subnetpool None $NET_ID $CIDR
239 239
     neutron_debug_admin probe-create --device-owner compute $NET_ID
240 240
     source $TOP_DIR/openrc demo demo
241 241
 }
... ...
@@ -542,12 +542,12 @@ function create_neutron_initial_network {
542 542
         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID"
543 543
 
544 544
         if [[ "$IP_VERSION" =~ 4.* ]]; then
545
-            SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
545
+            SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY --subnetpool None $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
546 546
             die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $TENANT_ID"
547 547
         fi
548 548
 
549 549
         if [[ "$IP_VERSION" =~ .*6 ]]; then
550
-            SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
550
+            SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 --subnetpool_id None $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2)
551 551
             die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $PROVIDER_SUBNET_NAME_V6 $TENANT_ID"
552 552
         fi
553 553
 
... ...
@@ -1236,6 +1236,7 @@ function _neutron_create_private_subnet_v4 {
1236 1236
     subnet_params+="--ip_version 4 "
1237 1237
     subnet_params+="--gateway $NETWORK_GATEWAY "
1238 1238
     subnet_params+="--name $PRIVATE_SUBNET_NAME "
1239
+    subnet_params+="--subnetpool None "
1239 1240
     subnet_params+="$NET_ID $FIXED_RANGE"
1240 1241
     local subnet_id
1241 1242
     subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
... ...
@@ -1252,6 +1253,7 @@ function _neutron_create_private_subnet_v6 {
1252 1252
     subnet_params+="--ip_version 6 "
1253 1253
     subnet_params+="--gateway $IPV6_PRIVATE_NETWORK_GATEWAY "
1254 1254
     subnet_params+="--name $IPV6_PRIVATE_SUBNET_NAME "
1255
+    subnet_params+="--subnetpool None "
1255 1256
     subnet_params+="$NET_ID $FIXED_RANGE_V6 $ipv6_modes"
1256 1257
     local ipv6_subnet_id
1257 1258
     ipv6_subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
... ...
@@ -1265,6 +1267,7 @@ function _neutron_create_public_subnet_v4 {
1265 1265
     subnet_params+="${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} "
1266 1266
     subnet_params+="--gateway $PUBLIC_NETWORK_GATEWAY "
1267 1267
     subnet_params+="--name $PUBLIC_SUBNET_NAME "
1268
+    subnet_params+="--subnetpool None "
1268 1269
     subnet_params+="$EXT_NET_ID $FLOATING_RANGE "
1269 1270
     subnet_params+="-- --enable_dhcp=False"
1270 1271
     local id_and_ext_gw_ip
... ...
@@ -1278,6 +1281,7 @@ function _neutron_create_public_subnet_v6 {
1278 1278
     local subnet_params="--ip_version 6 "
1279 1279
     subnet_params+="--gateway $IPV6_PUBLIC_NETWORK_GATEWAY "
1280 1280
     subnet_params+="--name $IPV6_PUBLIC_SUBNET_NAME "
1281
+    subnet_params+="--subnetpool None "
1281 1282
     subnet_params+="$EXT_NET_ID $IPV6_PUBLIC_RANGE "
1282 1283
     subnet_params+="-- --enable_dhcp=False"
1283 1284
     local ipv6_id_and_ext_gw_ip