From 907d41c2623809702b887ada97a87a2e7a23dfba Mon Sep 17 00:00:00 2001 From: Naohiro Tamura Date: Thu, 19 Feb 2015 20:57:20 +0900 Subject: [PATCH] Add error checks to provider net and subnet creation Error checks are added to detect provider network and subnet creation. Closes-Bug: #1423766 Change-Id: I4d4323d1c3159f84ce3d19924a569b153038d542 --- lib/neutron | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/neutron b/lib/neutron index 8d27febf63..3804e05271 100755 --- a/lib/neutron +++ b/lib/neutron @@ -538,13 +538,16 @@ function create_neutron_initial_network { die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK" die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE" NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_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) + die_if_not_set $LINENO NET_ID "Failure creating NET_ID for $PHYSICAL_NETWORK $TENANT_ID" if [[ "$IP_VERSION" =~ 4.* ]]; then 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) + die_if_not_set $LINENO SUBNET_ID "Failure creating SUBNET_ID for $PROVIDER_SUBNET_NAME $TENANT_ID" fi if [[ "$IP_VERSION" =~ .*6 ]]; then SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2) + die_if_not_set $LINENO SUBNET_V6_ID "Failure creating SUBNET_V6_ID for $PROVIDER_SUBNET_NAME_V6 $TENANT_ID" fi sudo ip link set $OVS_PHYSICAL_BRIDGE up