@@ -556,16 +556,16 @@ function create_neutron_initial_network {
556556 if is_provider_network; then
557557 die_if_not_set $LINENO PHYSICAL_NETWORK " You must specify the PHYSICAL_NETWORK"
558558 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)
560560 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PHYSICAL_NETWORK $project_id "
561561
562562 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)
564564 die_if_not_set $LINENO SUBNET_ID " Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $project_id "
565565 fi
566566
567567 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)
569569 die_if_not_set $LINENO SUBNET_V6_ID " Failure creating SUBNET_V6_ID for $IPV6_PROVIDER_SUBNET_NAME $project_id "
570570 fi
571571
@@ -575,7 +575,7 @@ function create_neutron_initial_network {
575575 sudo ip link set $PUBLIC_INTERFACE up
576576 fi
577577 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)
579579 die_if_not_set $LINENO NET_ID " Failure creating NET_ID for $PRIVATE_NETWORK_NAME $project_id "
580580
581581 if [[ " $IP_VERSION " =~ 4.* ]]; then
@@ -589,17 +589,17 @@ function create_neutron_initial_network {
589589 fi
590590 fi
591591
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)
594594 if [[ " $Q_L3_ENABLED " == " True" ]]; then
595595 # Create a router, and add the private subnet as one of its interfaces
596596 if [[ " $Q_L3_ROUTER_PER_TENANT " == " True" ]]; then
597597 # 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)
599599 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $project_id $Q_ROUTER_NAME "
600600 else
601601 # 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)
603603 die_if_not_set $LINENO ROUTER_ID " Failure creating ROUTER_ID for $Q_ROUTER_NAME "
604604 fi
605605
@@ -609,17 +609,17 @@ function create_neutron_initial_network {
609609 if [[ -n $AUTO_ALLOCATE_EXT && -n $SUBNETPOOL_EXT ]]; then
610610 EXTERNAL_NETWORK_FLAGS=" $EXTERNAL_NETWORK_FLAGS --is-default"
611611 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)
613613 fi
614614 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)
616616 fi
617617 fi
618618 # Create an external network, and a subnet. Configure the external network as router gw
619619 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)
621621 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)
623623 fi
624624 die_if_not_set $LINENO EXT_NET_ID " Failure creating EXT_NET_ID for $PUBLIC_NETWORK_NAME "
625625
@@ -974,6 +974,9 @@ function _configure_neutron_common {
974974 iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
975975 iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR /neutron/lock
976976
977+ # NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
978+ iniset $NEUTRON_CONF nova region_name $REGION_NAME
979+
977980 # If addition config files are set, make sure their path name is set as well
978981 if [[ ${# Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == ' ' ]]; then
979982 die $LINENO " Neutron additional plugin config not set.. exiting"
@@ -1289,7 +1292,7 @@ function _neutron_create_private_subnet_v4 {
12891292 subnet_params+=" --name $PRIVATE_SUBNET_NAME "
12901293 subnet_params+=" $NET_ID $FIXED_RANGE "
12911294 local subnet_id
1292- subnet_id=$( neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1295+ subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep ' id ' | get_field 2)
12931296 die_if_not_set $LINENO subnet_id " Failure creating private IPv4 subnet for $project_id "
12941297 echo $subnet_id
12951298}
@@ -1306,7 +1309,7 @@ function _neutron_create_private_subnet_v6 {
13061309 subnet_params+=" --name $IPV6_PRIVATE_SUBNET_NAME "
13071310 subnet_params+=" $NET_ID $FIXED_RANGE_V6 $ipv6_modes "
13081311 local ipv6_subnet_id
1309- ipv6_subnet_id=$( neutron subnet-create $subnet_params | grep ' id ' | get_field 2)
1312+ ipv6_subnet_id=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep ' id ' | get_field 2)
13101313 die_if_not_set $LINENO ipv6_subnet_id " Failure creating private IPv6 subnet for $project_id "
13111314 echo $ipv6_subnet_id
13121315}
@@ -1320,7 +1323,7 @@ function _neutron_create_public_subnet_v4 {
13201323 subnet_params+=" $EXT_NET_ID $FLOATING_RANGE "
13211324 subnet_params+=" -- --enable_dhcp=False"
13221325 local id_and_ext_gw_ip
1323- id_and_ext_gw_ip=$( neutron subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
1326+ id_and_ext_gw_ip=$( neutron --os-cloud devstack-admin --os-region " $REGION_NAME " subnet-create $subnet_params | grep -e ' gateway_ip' -e ' id ' )
13241327 die_if_not_set $LINENO id_and_ext_gw_ip " Failure creating public IPv4 subnet"
13251328 echo $id_and_ext_gw_ip
13261329}
@@ -1333,22 +1336,22 @@ function _neutron_create_public_subnet_v6 {
13331336 subnet_params+=" $EXT_NET_ID $IPV6_PUBLIC_RANGE "
13341337 subnet_params+=" -- --enable_dhcp=False"
13351338 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 ' )
1339+ 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 ' )
13371340 die_if_not_set $LINENO ipv6_id_and_ext_gw_ip " Failure creating an IPv6 public subnet"
13381341 echo $ipv6_id_and_ext_gw_ip
13391342}
13401343
13411344# Configure neutron router for IPv4 public access
13421345function _neutron_configure_router_v4 {
1343- neutron router-interface-add $ROUTER_ID $SUBNET_ID
1346+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface-add $ROUTER_ID $SUBNET_ID
13441347 # Create a public subnet on the external network
13451348 local id_and_ext_gw_ip
13461349 id_and_ext_gw_ip=$( _neutron_create_public_subnet_v4 $EXT_NET_ID )
13471350 local ext_gw_ip
13481351 ext_gw_ip=$( echo $id_and_ext_gw_ip | get_field 2)
13491352 PUB_SUBNET_ID=$( echo $id_and_ext_gw_ip | get_field 5)
13501353 # Configure the external network as the default router gateway
1351- neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1354+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-gateway-set $ROUTER_ID $EXT_NET_ID
13521355
13531356 # This logic is specific to using the l3-agent for layer 3
13541357 if is_service_enabled q-l3; then
@@ -1370,7 +1373,7 @@ function _neutron_configure_router_v4 {
13701373 sudo ip addr add $ext_gw_ip /$cidr_len dev $ext_gw_interface
13711374 sudo ip link set $ext_gw_interface up
13721375 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' ' ' `
1376+ 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' ' ' )
13741377 die_if_not_set $LINENO ROUTER_GW_IP " Failure retrieving ROUTER_GW_IP"
13751378 sudo ip route replace $FIXED_RANGE via $ROUTER_GW_IP
13761379 fi
@@ -1380,7 +1383,7 @@ function _neutron_configure_router_v4 {
13801383
13811384# Configure neutron router for IPv6 public access
13821385function _neutron_configure_router_v6 {
1383- neutron router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
1386+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-interface-add $ROUTER_ID $IPV6_SUBNET_ID
13841387 # Create a public subnet on the external network
13851388 local ipv6_id_and_ext_gw_ip
13861389 ipv6_id_and_ext_gw_ip=$( _neutron_create_public_subnet_v6 $EXT_NET_ID )
@@ -1392,7 +1395,7 @@ function _neutron_configure_router_v6 {
13921395 # If the external network has not already been set as the default router
13931396 # gateway when configuring an IPv4 public subnet, do so now
13941397 if [[ " $IP_VERSION " == " 6" ]]; then
1395- neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
1398+ neutron --os-cloud devstack-admin --os-region " $REGION_NAME " router-gateway-set $ROUTER_ID $EXT_NET_ID
13961399 fi
13971400
13981401 # This logic is specific to using the l3-agent for layer 3
@@ -1401,7 +1404,7 @@ function _neutron_configure_router_v6 {
14011404 sudo sysctl -w net.ipv6.conf.all.forwarding=1
14021405 # Configure and enable public bridge
14031406 # 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' ' ' `
1407+ 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' ' ' )
14051408 die_if_not_set $LINENO IPV6_ROUTER_GW_IP " Failure retrieving IPV6_ROUTER_GW_IP"
14061409
14071410 if is_neutron_ovs_base_plugin; then
@@ -1466,7 +1469,7 @@ function teardown_neutron_debug {
14661469}
14671470
14681471function _get_net_id {
1469- neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk ' {print $2}'
1472+ 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}'
14701473}
14711474
14721475function _get_probe_cmd_prefix {
0 commit comments