Added functionallity to allow _move_neutron_addresses_route to support
interfaces without a configured IP address. If PUBLIC_INTERFACE is set
to an interface without a configured IP, only the port will be
added to the OVS_PHYSICAL_BRIDGE.
Change-Id: I511ea5229ab871298086af5c96761390529bd85e
... | ... |
@@ -793,7 +793,8 @@ function stop_neutron { |
793 | 793 |
} |
794 | 794 |
|
795 | 795 |
# _move_neutron_addresses_route() - Move the primary IP to the OVS bridge |
796 |
-# on startup, or back to the public interface on cleanup |
|
796 |
+# on startup, or back to the public interface on cleanup. If no IP is |
|
797 |
+# configured on the interface, just add it as a port to the OVS bridge. |
|
797 | 798 |
function _move_neutron_addresses_route { |
798 | 799 |
local from_intf=$1 |
799 | 800 |
local to_intf=$2 |
... | ... |
@@ -806,7 +807,8 @@ function _move_neutron_addresses_route { |
806 | 806 |
# on configure we will also add $from_intf as a port on $to_intf, |
807 | 807 |
# assuming it is an OVS bridge. |
808 | 808 |
|
809 |
- local IP_BRD=$(ip -f $af a s dev $from_intf | awk '/inet/ { print $2, $3, $4; exit }') |
|
809 |
+ local IP_ADD="" |
|
810 |
+ local IP_DEL="" |
|
810 | 811 |
local DEFAULT_ROUTE_GW=$(ip r | awk "/default.+$from_intf/ { print \$3; exit }") |
811 | 812 |
local ADD_OVS_PORT="" |
812 | 813 |
|
... | ... |
@@ -826,7 +828,12 @@ function _move_neutron_addresses_route { |
826 | 826 |
ADD_OVS_PORT="sudo ovs-vsctl --may-exist add-port $to_intf $from_intf" |
827 | 827 |
fi |
828 | 828 |
|
829 |
- sudo ip addr del $IP_BRD dev $from_intf; sudo ip addr add $IP_BRD dev $to_intf; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE |
|
829 |
+ if [[ "$IP_BRD" != "" ]]; then |
|
830 |
+ IP_ADD="sudo ip addr del $IP_BRD dev $from_intf" |
|
831 |
+ IP_DEL="sudo ip addr add $IP_BRD dev $to_intf" |
|
832 |
+ fi |
|
833 |
+ |
|
834 |
+ $IP_ADD; $IP_DEL; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE |
|
830 | 835 |
fi |
831 | 836 |
} |
832 | 837 |
|
... | ... |
@@ -834,9 +841,7 @@ function _move_neutron_addresses_route { |
834 | 834 |
# runs that a clean run would need to clean up |
835 | 835 |
function cleanup_neutron { |
836 | 836 |
|
837 |
- if [[ $(ip -f inet a s dev "$OVS_PHYSICAL_BRIDGE" | grep -c 'global') != 0 ]]; then |
|
838 |
- _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False "inet" |
|
839 |
- fi |
|
837 |
+ _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False "inet" |
|
840 | 838 |
|
841 | 839 |
if [[ $(ip -f inet6 a s dev "$OVS_PHYSICAL_BRIDGE" | grep -c 'global') != 0 ]]; then |
842 | 840 |
_move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False "inet6" |
... | ... |
@@ -1021,9 +1026,7 @@ function _configure_neutron_l3_agent { |
1021 | 1021 |
|
1022 | 1022 |
neutron_plugin_configure_l3_agent |
1023 | 1023 |
|
1024 |
- if [[ $(ip -f inet a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then |
|
1025 |
- _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True "inet" |
|
1026 |
- fi |
|
1024 |
+ _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True "inet" |
|
1027 | 1025 |
|
1028 | 1026 |
if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then |
1029 | 1027 |
_move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False "inet6" |