Browse code

Merge "Adjust region name for images, networks and volumes during deployment"

Jenkins authored on 2016/05/07 05:48:52
Showing 4 changed files
... ...
@@ -83,7 +83,7 @@ function upload_image {
83 83
     # OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
84 84
     if [[ "$image_url" =~ 'openvz' ]]; then
85 85
         image_name="${image_fname%.tar.gz}"
86
-        openstack --os-cloud=devstack-admin image create "$image_name" --public --container-format ami --disk-format ami < "${image}"
86
+        openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" --public --container-format ami --disk-format ami < "${image}"
87 87
         return
88 88
     fi
89 89
 
... ...
@@ -197,7 +197,7 @@ function upload_image {
197 197
         vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
198 198
         vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}"
199 199
 
200
-        openstack --os-cloud=devstack-admin image create "$image_name" --public --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}"
200
+        openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" --public --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}"
201 201
         return
202 202
     fi
203 203
 
... ...
@@ -214,7 +214,7 @@ function upload_image {
214 214
             force_vm_mode="--property vm_mode=xen"
215 215
         fi
216 216
         openstack \
217
-            --os-cloud=devstack-admin \
217
+            --os-cloud=devstack-admin --os-region-name="$REGION_NAME" \
218 218
             image create \
219 219
             "$image_name" --public \
220 220
             --container-format=ovf --disk-format=vhd \
... ...
@@ -228,7 +228,7 @@ function upload_image {
228 228
     if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then
229 229
         image_name="${image_fname%.xen-raw.tgz}"
230 230
         openstack \
231
-            --os-cloud=devstack-admin \
231
+            --os-cloud=devstack-admin --os-region-name="$REGION_NAME" \
232 232
             image create \
233 233
             "$image_name" --public \
234 234
             --container-format=tgz --disk-format=raw \
... ...
@@ -244,7 +244,7 @@ function upload_image {
244 244
         fi
245 245
 
246 246
         openstack \
247
-            --os-cloud=devstack-admin \
247
+            --os-cloud=devstack-admin --os-region-name="$REGION_NAME" \
248 248
             image create \
249 249
             "$image_name" --public \
250 250
             --container-format=bare --disk-format=ploop \
... ...
@@ -327,9 +327,9 @@ function upload_image {
327 327
 
328 328
     if [ "$container_format" = "bare" ]; then
329 329
         if [ "$unpack" = "zcat" ]; then
330
-            openstack --os-cloud=devstack-admin image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
330
+            openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
331 331
         else
332
-            openstack --os-cloud=devstack-admin image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}"
332
+            openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}"
333 333
         fi
334 334
     else
335 335
         # Use glance client to add the kernel the root filesystem.
... ...
@@ -337,12 +337,12 @@ function upload_image {
337 337
         # kernel for use when uploading the root filesystem.
338 338
         local kernel_id="" ramdisk_id="";
339 339
         if [ -n "$kernel" ]; then
340
-            kernel_id=$(openstack --os-cloud=devstack-admin image create "$image_name-kernel" $img_property --public --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2)
340
+            kernel_id=$(openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name-kernel" $img_property --public --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2)
341 341
         fi
342 342
         if [ -n "$ramdisk" ]; then
343
-            ramdisk_id=$(openstack --os-cloud=devstack-admin image create "$image_name-ramdisk" $img_property --public --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2)
343
+            ramdisk_id=$(openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "$image_name-ramdisk" $img_property --public --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2)
344 344
         fi
345
-        openstack --os-cloud=devstack-admin image create "${image_name%.img}" $img_property --public --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}"
345
+        openstack --os-cloud=devstack-admin --os-region-name="$REGION_NAME" image create "${image_name%.img}" $img_property --public --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}"
346 346
     fi
347 347
 }
348 348
 
... ...
@@ -560,7 +560,7 @@ function create_volume_types {
560 560
         local be be_name
561 561
         for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
562 562
             be_name=${be##*:}
563
-            openstack volume type create --property volume_backend_name="${be_name}" ${be_name}
563
+            openstack --os-region-name="$REGION_NAME" volume type create --property volume_backend_name="${be_name}" ${be_name}
564 564
         done
565 565
     fi
566 566
 }
... ...
@@ -524,16 +524,16 @@ function create_neutron_initial_network {
524 524
     if is_provider_network; then
525 525
         die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
526 526
         die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specify the PROVIDER_NETWORK_TYPE"
527
-        NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $project_id --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
527
+        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create $PHYSICAL_NETWORK --tenant_id $project_id --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2)
528 528
         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $project_id"
529 529
 
530 530
         if [[ "$IP_VERSION" =~ 4.* ]]; then
531
-            SUBNET_ID=$(neutron subnet-create --tenant_id $project_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)
531
+            SUBNET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_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)
532 532
             die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id"
533 533
         fi
534 534
 
535 535
         if [[ "$IP_VERSION" =~ .*6 ]] && [[ -n "$IPV6_PROVIDER_FIXED_RANGE" ]] && [[ -n "$IPV6_PROVIDER_NETWORK_GATEWAY" ]]; then
536
-            SUBNET_V6_ID=$(neutron subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep 'id' | get_field 2)
536
+            SUBNET_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create --tenant_id $project_id --ip_version 6 --ipv6-address-mode $IPV6_ADDRESS_MODE --gateway $IPV6_PROVIDER_NETWORK_GATEWAY --name $IPV6_PROVIDER_SUBNET_NAME $NET_ID $IPV6_PROVIDER_FIXED_RANGE | grep 'id' | get_field 2)
537 537
             die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id"
538 538
         fi
539 539
 
... ...
@@ -543,7 +543,7 @@ function create_neutron_initial_network {
543 543
             sudo ip link set $PUBLIC_INTERFACE up
544 544
         fi
545 545
     else
546
-        NET_ID=$(neutron net-create --tenant-id $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
546
+        NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create --tenant-id $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
547 547
         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id"
548 548
 
549 549
         if [[ "$IP_VERSION" =~ 4.* ]]; then
... ...
@@ -557,17 +557,17 @@ function create_neutron_initial_network {
557 557
         fi
558 558
     fi
559 559
 
560
-    AUTO_ALLOCATE_EXT=$(neutron ext-list | grep 'auto-allocated-topology' | get_field 1)
561
-    SUBNETPOOL_EXT=$(neutron ext-list | grep 'subnet_allocation' | get_field 1)
560
+    AUTO_ALLOCATE_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'auto-allocated-topology' | get_field 1)
561
+    SUBNETPOOL_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'subnet_allocation' | get_field 1)
562 562
     if [[ "$Q_L3_ENABLED" == "True" ]]; then
563 563
         # Create a router, and add the private subnet as one of its interfaces
564 564
         if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
565 565
             # create a tenant-owned router.
566
-            ROUTER_ID=$(neutron router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
566
+            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
567 567
             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME"
568 568
         else
569 569
             # Plugin only supports creating a single router, which should be admin owned.
570
-            ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
570
+            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
571 571
             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
572 572
         fi
573 573
 
... ...
@@ -577,17 +577,17 @@ function create_neutron_initial_network {
577 577
         if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
578 578
             EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --is-default"
579 579
             if [[ "$IP_VERSION" =~ 4.* ]]; then
580
-                SUBNETPOOL_V4_ID=$(neutron subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
580
+                SUBNETPOOL_V4_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V4 --pool-prefix $SUBNETPOOL_PREFIX_V4 --shared --is-default=True | grep ' id ' | get_field 2)
581 581
             fi
582 582
             if [[ "$IP_VERSION" =~ .*6 ]]; then
583
-                SUBNETPOOL_V6_ID=$(neutron subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
583
+                SUBNETPOOL_V6_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnetpool-create $SUBNETPOOL_NAME --default-prefixlen $SUBNETPOOL_SIZE_V6 --pool-prefix $SUBNETPOOL_PREFIX_V6 --shared --is-default=True | grep ' id ' | get_field 2)
584 584
             fi
585 585
         fi
586 586
         # Create an external network, and a subnet. Configure the external network as router gw
587 587
         if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
588
-            EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
588
+            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS --provider:network_type=flat --provider:physical_network=${PUBLIC_PHYSICAL_NETWORK} | grep ' id ' | get_field 2)
589 589
         else
590
-            EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
590
+            EXT_NET_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
591 591
         fi
592 592
         die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
593 593
 
... ...
@@ -933,6 +933,9 @@ function _configure_neutron_common {
933 933
     iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
934 934
     iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR/neutron/lock
935 935
 
936
+    # NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
937
+    iniset $NEUTRON_CONF nova region_name $REGION_NAME
938
+
936 939
     # If addition config files are set, make sure their path name is set as well
937 940
     if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
938 941
         die $LINENO "Neutron additional plugin config not set.. exiting"
... ...
@@ -1233,7 +1236,7 @@ function _neutron_create_private_subnet_v4 {
1233 1233
     subnet_params+="--name $PRIVATE_SUBNET_NAME "
1234 1234
     subnet_params+="$NET_ID $FIXED_RANGE"
1235 1235
     local subnet_id
1236
-    subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1236
+    subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1237 1237
     die_if_not_set $LINENO subnet_id "Failure creating private IPv4 subnet for $project_id"
1238 1238
     echo $subnet_id
1239 1239
 }
... ...
@@ -1250,7 +1253,7 @@ function _neutron_create_private_subnet_v6 {
1250 1250
     subnet_params+="--name $IPV6_PRIVATE_SUBNET_NAME "
1251 1251
     subnet_params+="$NET_ID $FIXED_RANGE_V6 $ipv6_modes"
1252 1252
     local ipv6_subnet_id
1253
-    ipv6_subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1253
+    ipv6_subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1254 1254
     die_if_not_set $LINENO ipv6_subnet_id "Failure creating private IPv6 subnet for $project_id"
1255 1255
     echo $ipv6_subnet_id
1256 1256
 }
... ...
@@ -1264,7 +1267,7 @@ function _neutron_create_public_subnet_v4 {
1264 1264
     subnet_params+="$EXT_NET_ID $FLOATING_RANGE "
1265 1265
     subnet_params+="-- --enable_dhcp=False"
1266 1266
     local id_and_ext_gw_ip
1267
-    id_and_ext_gw_ip=$(neutron subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1267
+    id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1268 1268
     die_if_not_set $LINENO id_and_ext_gw_ip "Failure creating public IPv4 subnet"
1269 1269
     echo $id_and_ext_gw_ip
1270 1270
 }
... ...
@@ -1277,14 +1280,14 @@ function _neutron_create_public_subnet_v6 {
1277 1277
     subnet_params+="$EXT_NET_ID $IPV6_PUBLIC_RANGE "
1278 1278
     subnet_params+="-- --enable_dhcp=False"
1279 1279
     local ipv6_id_and_ext_gw_ip
1280
-    ipv6_id_and_ext_gw_ip=$(neutron subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1280
+    ipv6_id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1281 1281
     die_if_not_set $LINENO ipv6_id_and_ext_gw_ip "Failure creating an IPv6 public subnet"
1282 1282
     echo $ipv6_id_and_ext_gw_ip
1283 1283
 }
1284 1284
 
1285 1285
 # Configure neutron router for IPv4 public access
1286 1286
 function _neutron_configure_router_v4 {
1287
-    neutron router-interface-add $ROUTER_ID $SUBNET_ID
1287
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $SUBNET_ID
1288 1288
     # Create a public subnet on the external network
1289 1289
     local id_and_ext_gw_ip
1290 1290
     id_and_ext_gw_ip=$(_neutron_create_public_subnet_v4 $EXT_NET_ID)
... ...
@@ -1292,7 +1295,7 @@ function _neutron_configure_router_v4 {
1292 1292
     ext_gw_ip=$(echo $id_and_ext_gw_ip  | get_field 2)
1293 1293
     PUB_SUBNET_ID=$(echo $id_and_ext_gw_ip | get_field 5)
1294 1294
     # Configure the external network as the default router gateway
1295
-    neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1295
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1296 1296
 
1297 1297
     # This logic is specific to using the l3-agent for layer 3
1298 1298
     if is_service_enabled q-l3; then
... ...
@@ -1314,7 +1317,7 @@ function _neutron_configure_router_v4 {
1314 1314
                 sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
1315 1315
                 sudo ip link set $ext_gw_interface up
1316 1316
             fi
1317
-            ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F'ip_address'  '{ print $2 }' | cut -f3 -d\" | tr '\n' ' '`
1317
+            ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F'ip_address'  '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
1318 1318
             die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
1319 1319
             sudo ip route replace  $FIXED_RANGE via $ROUTER_GW_IP
1320 1320
         fi
... ...
@@ -1324,7 +1327,7 @@ function _neutron_configure_router_v4 {
1324 1324
 
1325 1325
 # Configure neutron router for IPv6 public access
1326 1326
 function _neutron_configure_router_v6 {
1327
-    neutron router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1327
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1328 1328
     # Create a public subnet on the external network
1329 1329
     local ipv6_id_and_ext_gw_ip
1330 1330
     ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID)
... ...
@@ -1336,7 +1339,7 @@ function _neutron_configure_router_v6 {
1336 1336
     # If the external network has not already been set as the default router
1337 1337
     # gateway when configuring an IPv4 public subnet, do so now
1338 1338
     if [[ "$IP_VERSION" == "6" ]]; then
1339
-        neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1339
+        neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1340 1340
     fi
1341 1341
 
1342 1342
     # This logic is specific to using the l3-agent for layer 3
... ...
@@ -1345,7 +1348,7 @@ function _neutron_configure_router_v6 {
1345 1345
         sudo sysctl -w net.ipv6.conf.all.forwarding=1
1346 1346
         # Configure and enable public bridge
1347 1347
         # Override global IPV6_ROUTER_GW_IP with the true value from neutron
1348
-        IPV6_ROUTER_GW_IP=`neutron port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F'ip_address' '{ print $2 }' | cut -f3 -d\" | tr '\n' ' '`
1348
+        IPV6_ROUTER_GW_IP=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" port-list -c fixed_ips | grep $ipv6_pub_subnet_id | awk -F'ip_address' '{ print $2 }' | cut -f3 -d\" | tr '\n' ' ')
1349 1349
         die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"
1350 1350
 
1351 1351
         if is_neutron_ovs_base_plugin; then
... ...
@@ -1410,7 +1413,7 @@ function teardown_neutron_debug {
1410 1410
 }
1411 1411
 
1412 1412
 function _get_net_id {
1413
-    neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
1413
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
1414 1414
 }
1415 1415
 
1416 1416
 function _get_probe_cmd_prefix {
... ...
@@ -923,21 +923,21 @@ function stop_nova {
923 923
 # create_instance_types(): Create default flavors
924 924
 function create_flavors {
925 925
     if is_service_enabled n-api; then
926
-        if ! openstack flavor list | grep -q ds512M; then
926
+        if ! openstack --os-region-name="$REGION_NAME" flavor list | grep -q ds512M; then
927 927
             # Note that danms hates these flavors and apologizes for sdague
928
-            openstack flavor create --id c1 --ram 256 --disk 0 --vcpus 1 cirros256
929
-            openstack flavor create --id d1 --ram 512 --disk 5 --vcpus 1 ds512M
930
-            openstack flavor create --id d2 --ram 1024 --disk 10 --vcpus 1 ds1G
931
-            openstack flavor create --id d3 --ram 2048 --disk 10 --vcpus 2 ds2G
932
-            openstack flavor create --id d4 --ram 4096 --disk 20 --vcpus 4 ds4G
928
+            openstack --os-region-name="$REGION_NAME" flavor create --id c1 --ram 256 --disk 0 --vcpus 1 cirros256
929
+            openstack --os-region-name="$REGION_NAME" flavor create --id d1 --ram 512 --disk 5 --vcpus 1 ds512M
930
+            openstack --os-region-name="$REGION_NAME" flavor create --id d2 --ram 1024 --disk 10 --vcpus 1 ds1G
931
+            openstack --os-region-name="$REGION_NAME" flavor create --id d3 --ram 2048 --disk 10 --vcpus 2 ds2G
932
+            openstack --os-region-name="$REGION_NAME" flavor create --id d4 --ram 4096 --disk 20 --vcpus 4 ds4G
933 933
         fi
934 934
 
935
-        if ! openstack flavor list | grep -q m1.tiny; then
936
-            openstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
937
-            openstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
938
-            openstack flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
939
-            openstack flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
940
-            openstack flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
935
+        if ! openstack --os-region-name="$REGION_NAME" flavor list | grep -q m1.tiny; then
936
+            openstack --os-region-name="$REGION_NAME" flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
937
+            openstack --os-region-name="$REGION_NAME" flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
938
+            openstack --os-region-name="$REGION_NAME" flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
939
+            openstack --os-region-name="$REGION_NAME" flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
940
+            openstack --os-region-name="$REGION_NAME" flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
941 941
         fi
942 942
     fi
943 943
 }