Browse code

Adjust region name for images, networks and volumes during deployment

In a multiregion installation of devstack, conflicts occur in the
creation of images, networks, or volume types, when the region is not
set.

This patch adjusts commands to include the region, and
also adjusts the region_name in the nova configuration section of
neutron.conf to include the region.

Change-Id: Ifedff6a124fa49d57cc7b2f35916d8d96f5e5f7a

Victor Ryzhenkin authored on 2016/04/27 21:15: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
 }
... ...
@@ -556,16 +556,16 @@ function create_neutron_initial_network {
556 556
     if is_provider_network; then
557 557
         die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
558 558
         die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specify the PROVIDER_NETWORK_TYPE"
559
-        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)
559
+        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)
560 560
         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $project_id"
561 561
 
562 562
         if [[ "$IP_VERSION" =~ 4.* ]]; then
563
-            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)
563
+            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)
564 564
             die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id"
565 565
         fi
566 566
 
567 567
         if [[ "$IP_VERSION" =~ .*6 ]] && [[ -n "$IPV6_PROVIDER_FIXED_RANGE" ]] && [[ -n "$IPV6_PROVIDER_NETWORK_GATEWAY" ]]; then
568
-            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)
568
+            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)
569 569
             die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id"
570 570
         fi
571 571
 
... ...
@@ -575,7 +575,7 @@ function create_neutron_initial_network {
575 575
             sudo ip link set $PUBLIC_INTERFACE up
576 576
         fi
577 577
     else
578
-        NET_ID=$(neutron net-create --tenant-id $project_id "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
578
+        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)
579 579
         die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id"
580 580
 
581 581
         if [[ "$IP_VERSION" =~ 4.* ]]; then
... ...
@@ -589,17 +589,17 @@ function create_neutron_initial_network {
589 589
         fi
590 590
     fi
591 591
 
592
-    AUTO_ALLOCATE_EXT=$(neutron ext-list | grep 'auto-allocated-topology' | get_field 1)
593
-    SUBNETPOOL_EXT=$(neutron ext-list | grep 'subnet_allocation' | get_field 1)
592
+    AUTO_ALLOCATE_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'auto-allocated-topology' | get_field 1)
593
+    SUBNETPOOL_EXT=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" ext-list | grep 'subnet_allocation' | get_field 1)
594 594
     if [[ "$Q_L3_ENABLED" == "True" ]]; then
595 595
         # Create a router, and add the private subnet as one of its interfaces
596 596
         if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
597 597
             # create a tenant-owned router.
598
-            ROUTER_ID=$(neutron router-create --tenant-id $project_id $Q_ROUTER_NAME | grep ' id ' | get_field 2)
598
+            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)
599 599
             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME"
600 600
         else
601 601
             # Plugin only supports creating a single router, which should be admin owned.
602
-            ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
602
+            ROUTER_ID=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
603 603
             die_if_not_set $LINENO ROUTER_ID "Failure creating ROUTER_ID for $Q_ROUTER_NAME"
604 604
         fi
605 605
 
... ...
@@ -609,17 +609,17 @@ function create_neutron_initial_network {
609 609
         if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
610 610
             EXTERNAL_NETWORK_FLAGS="$EXTERNAL_NETWORK_FLAGS --is-default"
611 611
             if [[ "$IP_VERSION" =~ 4.* ]]; then
612
-                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)
612
+                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)
613 613
             fi
614 614
             if [[ "$IP_VERSION" =~ .*6 ]]; then
615
-                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)
615
+                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)
616 616
             fi
617 617
         fi
618 618
         # Create an external network, and a subnet. Configure the external network as router gw
619 619
         if [ "$Q_USE_PROVIDERNET_FOR_PUBLIC" = "True" ]; then
620
-            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)
620
+            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)
621 621
         else
622
-            EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- $EXTERNAL_NETWORK_FLAGS | grep ' id ' | get_field 2)
622
+            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)
623 623
         fi
624 624
         die_if_not_set $LINENO EXT_NET_ID "Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME"
625 625
 
... ...
@@ -974,6 +974,9 @@ function _configure_neutron_common {
974 974
     iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
975 975
     iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR/neutron/lock
976 976
 
977
+    # NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
978
+    iniset $NEUTRON_CONF nova region_name $REGION_NAME
979
+
977 980
     # If addition config files are set, make sure their path name is set as well
978 981
     if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
979 982
         die $LINENO "Neutron additional plugin config not set.. exiting"
... ...
@@ -1289,7 +1292,7 @@ function _neutron_create_private_subnet_v4 {
1289 1289
     subnet_params+="--name $PRIVATE_SUBNET_NAME "
1290 1290
     subnet_params+="$NET_ID $FIXED_RANGE"
1291 1291
     local subnet_id
1292
-    subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1292
+    subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1293 1293
     die_if_not_set $LINENO subnet_id "Failure creating private IPv4 subnet for $project_id"
1294 1294
     echo $subnet_id
1295 1295
 }
... ...
@@ -1306,7 +1309,7 @@ function _neutron_create_private_subnet_v6 {
1306 1306
     subnet_params+="--name $IPV6_PRIVATE_SUBNET_NAME "
1307 1307
     subnet_params+="$NET_ID $FIXED_RANGE_V6 $ipv6_modes"
1308 1308
     local ipv6_subnet_id
1309
-    ipv6_subnet_id=$(neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1309
+    ipv6_subnet_id=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep ' id ' | get_field 2)
1310 1310
     die_if_not_set $LINENO ipv6_subnet_id "Failure creating private IPv6 subnet for $project_id"
1311 1311
     echo $ipv6_subnet_id
1312 1312
 }
... ...
@@ -1320,7 +1323,7 @@ function _neutron_create_public_subnet_v4 {
1320 1320
     subnet_params+="$EXT_NET_ID $FLOATING_RANGE "
1321 1321
     subnet_params+="-- --enable_dhcp=False"
1322 1322
     local id_and_ext_gw_ip
1323
-    id_and_ext_gw_ip=$(neutron subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1323
+    id_and_ext_gw_ip=$(neutron --os-cloud devstack-admin --os-region "$REGION_NAME" subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1324 1324
     die_if_not_set $LINENO id_and_ext_gw_ip "Failure creating public IPv4 subnet"
1325 1325
     echo $id_and_ext_gw_ip
1326 1326
 }
... ...
@@ -1333,14 +1336,14 @@ function _neutron_create_public_subnet_v6 {
1333 1333
     subnet_params+="$EXT_NET_ID $IPV6_PUBLIC_RANGE "
1334 1334
     subnet_params+="-- --enable_dhcp=False"
1335 1335
     local ipv6_id_and_ext_gw_ip
1336
-    ipv6_id_and_ext_gw_ip=$(neutron subnet-create $subnet_params | grep -e 'gateway_ip' -e ' id ')
1336
+    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 ')
1337 1337
     die_if_not_set $LINENO ipv6_id_and_ext_gw_ip "Failure creating an IPv6 public subnet"
1338 1338
     echo $ipv6_id_and_ext_gw_ip
1339 1339
 }
1340 1340
 
1341 1341
 # Configure neutron router for IPv4 public access
1342 1342
 function _neutron_configure_router_v4 {
1343
-    neutron router-interface-add $ROUTER_ID $SUBNET_ID
1343
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $SUBNET_ID
1344 1344
     # Create a public subnet on the external network
1345 1345
     local id_and_ext_gw_ip
1346 1346
     id_and_ext_gw_ip=$(_neutron_create_public_subnet_v4 $EXT_NET_ID)
... ...
@@ -1348,7 +1351,7 @@ function _neutron_configure_router_v4 {
1348 1348
     ext_gw_ip=$(echo $id_and_ext_gw_ip  | get_field 2)
1349 1349
     PUB_SUBNET_ID=$(echo $id_and_ext_gw_ip | get_field 5)
1350 1350
     # Configure the external network as the default router gateway
1351
-    neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1351
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1352 1352
 
1353 1353
     # This logic is specific to using the l3-agent for layer 3
1354 1354
     if is_service_enabled q-l3; then
... ...
@@ -1370,7 +1373,7 @@ function _neutron_configure_router_v4 {
1370 1370
                 sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
1371 1371
                 sudo ip link set $ext_gw_interface up
1372 1372
             fi
1373
-            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' ' '`
1373
+            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' ' ')
1374 1374
             die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
1375 1375
             sudo ip route replace  $FIXED_RANGE via $ROUTER_GW_IP
1376 1376
         fi
... ...
@@ -1380,7 +1383,7 @@ function _neutron_configure_router_v4 {
1380 1380
 
1381 1381
 # Configure neutron router for IPv6 public access
1382 1382
 function _neutron_configure_router_v6 {
1383
-    neutron router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1383
+    neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1384 1384
     # Create a public subnet on the external network
1385 1385
     local ipv6_id_and_ext_gw_ip
1386 1386
     ipv6_id_and_ext_gw_ip=$(_neutron_create_public_subnet_v6 $EXT_NET_ID)
... ...
@@ -1392,7 +1395,7 @@ function _neutron_configure_router_v6 {
1392 1392
     # If the external network has not already been set as the default router
1393 1393
     # gateway when configuring an IPv4 public subnet, do so now
1394 1394
     if [[ "$IP_VERSION" == "6" ]]; then
1395
-        neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1395
+        neutron --os-cloud devstack-admin --os-region "$REGION_NAME" router-gateway-set $ROUTER_ID $EXT_NET_ID
1396 1396
     fi
1397 1397
 
1398 1398
     # This logic is specific to using the l3-agent for layer 3
... ...
@@ -1401,7 +1404,7 @@ function _neutron_configure_router_v6 {
1401 1401
         sudo sysctl -w net.ipv6.conf.all.forwarding=1
1402 1402
         # Configure and enable public bridge
1403 1403
         # Override global IPV6_ROUTER_GW_IP with the true value from neutron
1404
-        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' ' '`
1404
+        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' ' ')
1405 1405
         die_if_not_set $LINENO IPV6_ROUTER_GW_IP "Failure retrieving IPV6_ROUTER_GW_IP"
1406 1406
 
1407 1407
         if is_neutron_ovs_base_plugin; then
... ...
@@ -1466,7 +1469,7 @@ function teardown_neutron_debug {
1466 1466
 }
1467 1467
 
1468 1468
 function _get_net_id {
1469
-    neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
1469
+    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}'
1470 1470
 }
1471 1471
 
1472 1472
 function _get_probe_cmd_prefix {
... ...
@@ -935,21 +935,21 @@ function stop_nova {
935 935
 # create_instance_types(): Create default flavors
936 936
 function create_flavors {
937 937
     if is_service_enabled n-api; then
938
-        if ! openstack flavor list | grep -q ds512M; then
938
+        if ! openstack --os-region-name="$REGION_NAME" flavor list | grep -q ds512M; then
939 939
             # Note that danms hates these flavors and apologizes for sdague
940
-            openstack flavor create --id c1 --ram 256 --disk 0 --vcpus 1 cirros256
941
-            openstack flavor create --id d1 --ram 512 --disk 5 --vcpus 1 ds512M
942
-            openstack flavor create --id d2 --ram 1024 --disk 10 --vcpus 1 ds1G
943
-            openstack flavor create --id d3 --ram 2048 --disk 10 --vcpus 2 ds2G
944
-            openstack flavor create --id d4 --ram 4096 --disk 20 --vcpus 4 ds4G
940
+            openstack --os-region-name="$REGION_NAME" flavor create --id c1 --ram 256 --disk 0 --vcpus 1 cirros256
941
+            openstack --os-region-name="$REGION_NAME" flavor create --id d1 --ram 512 --disk 5 --vcpus 1 ds512M
942
+            openstack --os-region-name="$REGION_NAME" flavor create --id d2 --ram 1024 --disk 10 --vcpus 1 ds1G
943
+            openstack --os-region-name="$REGION_NAME" flavor create --id d3 --ram 2048 --disk 10 --vcpus 2 ds2G
944
+            openstack --os-region-name="$REGION_NAME" flavor create --id d4 --ram 4096 --disk 20 --vcpus 4 ds4G
945 945
         fi
946 946
 
947
-        if ! openstack flavor list | grep -q m1.tiny; then
948
-            openstack flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
949
-            openstack flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
950
-            openstack flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
951
-            openstack flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
952
-            openstack flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
947
+        if ! openstack --os-region-name="$REGION_NAME" flavor list | grep -q m1.tiny; then
948
+            openstack --os-region-name="$REGION_NAME" flavor create --id 1 --ram 512 --disk 1 --vcpus 1 m1.tiny
949
+            openstack --os-region-name="$REGION_NAME" flavor create --id 2 --ram 2048 --disk 20 --vcpus 1 m1.small
950
+            openstack --os-region-name="$REGION_NAME" flavor create --id 3 --ram 4096 --disk 40 --vcpus 2 m1.medium
951
+            openstack --os-region-name="$REGION_NAME" flavor create --id 4 --ram 8192 --disk 80 --vcpus 4 m1.large
952
+            openstack --os-region-name="$REGION_NAME" flavor create --id 5 --ram 16384 --disk 160 --vcpus 8 m1.xlarge
953 953
         fi
954 954
     fi
955 955
 }