Added functionallity to allow IPv6 addresses to be moved to the
OVS_PHYSICAL_BRIDGE from PUBLIC_INTERFACE automatically using
_move_neutron_addresses_route. Only PUBLIC_INTERFACE and
OVS_PHYSICAL_BRIDGE need to be set in localrc.
HOST_IP must be set in localrc. HOST_IPV6 must be set in localrc if a
global IPv6 address is configured on PUBLIC_INTERFACE.
Change-Id: I8d2c055702e1c7cf08499a77f6843393762fd4c1
... | ... |
@@ -788,6 +788,7 @@ function _move_neutron_addresses_route { |
788 | 788 |
local from_intf=$1 |
789 | 789 |
local to_intf=$2 |
790 | 790 |
local add_ovs_port=$3 |
791 |
+ local af=$4 |
|
791 | 792 |
|
792 | 793 |
if [[ -n "$from_intf" && -n "$to_intf" ]]; then |
793 | 794 |
# Remove the primary IP address from $from_intf and add it to $to_intf, |
... | ... |
@@ -795,10 +796,18 @@ function _move_neutron_addresses_route { |
795 | 795 |
# on configure we will also add $from_intf as a port on $to_intf, |
796 | 796 |
# assuming it is an OVS bridge. |
797 | 797 |
|
798 |
- local IP_BRD=$(ip -4 a s dev $from_intf | awk '/inet/ { print $2, $3, $4; exit }') |
|
798 |
+ local IP_BRD=$(ip -f $af a s dev $from_intf | awk '/inet/ { print $2, $3, $4; exit }') |
|
799 | 799 |
local DEFAULT_ROUTE_GW=$(ip r | awk "/default.+$from_intf/ { print \$3; exit }") |
800 | 800 |
local ADD_OVS_PORT="" |
801 | 801 |
|
802 |
+ if [[ $af == "inet" ]]; then |
|
803 |
+ IP_BRD=$(ip -f $af a s dev $from_intf | grep $HOST_IP | awk '{ print $2, $3, $4; exit }') |
|
804 |
+ fi |
|
805 |
+ |
|
806 |
+ if [[ $af == "inet6" ]]; then |
|
807 |
+ IP_BRD=$(ip -f $af a s dev $from_intf | grep $HOST_IPV6 | awk '{ print $2, $3, $4; exit }') |
|
808 |
+ fi |
|
809 |
+ |
|
802 | 810 |
if [ "$DEFAULT_ROUTE_GW" != "" ]; then |
803 | 811 |
ADD_DEFAULT_ROUTE="sudo ip r replace default via $DEFAULT_ROUTE_GW dev $to_intf" |
804 | 812 |
fi |
... | ... |
@@ -815,7 +824,13 @@ function _move_neutron_addresses_route { |
815 | 815 |
# runs that a clean run would need to clean up |
816 | 816 |
function cleanup_neutron { |
817 | 817 |
|
818 |
- _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False |
|
818 |
+ if [[ $(ip -f inet a s dev "$OVS_PHYSICAL_BRIDGE" | grep -c 'global') != 0 ]]; then |
|
819 |
+ _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False "inet" |
|
820 |
+ fi |
|
821 |
+ |
|
822 |
+ if [[ $(ip -f inet6 a s dev "$OVS_PHYSICAL_BRIDGE" | grep -c 'global') != 0 ]]; then |
|
823 |
+ _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False "inet6" |
|
824 |
+ fi |
|
819 | 825 |
|
820 | 826 |
if is_provider_network && is_ironic_hardware; then |
821 | 827 |
for IP in $(ip addr show dev $OVS_PHYSICAL_BRIDGE | grep ' inet ' | awk '{print $2}'); do |
... | ... |
@@ -997,8 +1012,12 @@ function _configure_neutron_l3_agent { |
997 | 997 |
|
998 | 998 |
neutron_plugin_configure_l3_agent |
999 | 999 |
|
1000 |
- if [[ $(ip -4 a s dev "$PUBLIC_INTERFACE" | grep -c 'inet') != 0 ]]; then |
|
1001 |
- _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True |
|
1000 |
+ if [[ $(ip -f inet a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then |
|
1001 |
+ _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True "inet" |
|
1002 |
+ fi |
|
1003 |
+ |
|
1004 |
+ if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then |
|
1005 |
+ _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False "inet6" |
|
1002 | 1006 |
fi |
1003 | 1007 |
} |
1004 | 1008 |
|