lib/neutron-legacy: replace ip when re-stacking

Replicated Yi Zhao's fix for re-adding ipv6 addresses to neutron-legacy
(review I9ff62023dbc29a88aec3c48af331c0a49a1270bb).
Previously, re-stacking failed with "File exists" for ipv6 addresses
on br-ex.  With this change, the existing address is replaced on
br-ex with the appropriate address.

Change-Id: I6e6235132a34469f4e68b5bb3cf51ebdf01c83a2
This commit is contained in:
Matt McEuen
2016-07-11 08:37:59 -05:00
parent 12ce4ad306
commit e24707bb59

View File

@@ -610,7 +610,7 @@ function _move_neutron_addresses_route {
# on configure we will also add $from_intf as a port on $to_intf,
# assuming it is an OVS bridge.
local IP_ADD=""
local IP_REPLACE=""
local IP_DEL=""
local IP_UP=""
local DEFAULT_ROUTE_GW
@@ -635,7 +635,7 @@ function _move_neutron_addresses_route {
if [[ "$IP_BRD" != "" ]]; then
IP_DEL="sudo ip addr del $IP_BRD dev $from_intf"
IP_ADD="sudo ip addr add $IP_BRD dev $to_intf"
IP_REPLACE="sudo ip addr replace $IP_BRD dev $to_intf"
IP_UP="sudo ip link set $to_intf up"
if [[ "$af" == "inet" ]]; then
IP=$(echo $IP_BRD | awk '{ print $1; exit }' | grep -o -E '(.*)/' | cut -d "/" -f1)
@@ -645,7 +645,7 @@ function _move_neutron_addresses_route {
# The add/del OVS port calls have to happen either before or
# after the address is moved in order to not leave it orphaned.
$DEL_OVS_PORT; $IP_DEL; $IP_ADD; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
$DEL_OVS_PORT; $IP_DEL; $IP_REPLACE; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
fi
}