Browse code

Fix Neutron issues related to Baremetal service

When deploying devstack on a single host with a single NIC and
baremetal and neutron services enabled, the host looses Internet
access as default route is deleted.

Also, if localrc is not correctly set with correct values, OVS ports
and Neutron net and subnet aren't created (commands missing
arguments), we need devstack to properly fail.

Change-Id: I7f39bbdf7b8cb544b8b4a59effe16f04b85d1425

sbauza authored on 2013/08/30 00:29:46
Showing 1 changed files
... ...
@@ -327,6 +327,9 @@ function create_neutron_initial_network() {
327 327
     # Since neutron command is executed in admin context at this point,
328 328
     # ``--tenant_id`` needs to be specified.
329 329
     if is_baremetal; then
330
+        if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then
331
+            die $LINENO "Neutron settings for baremetal not set.. exiting"
332
+        fi
330 333
         sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
331 334
         for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
332 335
             sudo ip addr del $IP dev $PUBLIC_INTERFACE
... ...
@@ -335,6 +338,7 @@ function create_neutron_initial_network() {
335 335
         NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2)
336 336
         SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
337 337
         sudo ifconfig $OVS_PHYSICAL_BRIDGE up
338
+        sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
338 339
     else
339 340
         NET_ID=$(neutron net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
340 341
         SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
... ...
@@ -493,7 +497,7 @@ function _configure_neutron_common() {
493 493
     #    ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)``
494 494
     neutron_plugin_configure_common
495 495
 
496
-    if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then
496
+    if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then
497 497
         die $LINENO "Neutron plugin not set.. exiting"
498 498
     fi
499 499