Browse code

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

Matt McEuen authored on 2016/07/11 22:37:59
Showing 1 changed files
... ...
@@ -610,7 +610,7 @@ function _move_neutron_addresses_route {
610 610
         # on configure we will also add $from_intf as a port on $to_intf,
611 611
         # assuming it is an OVS bridge.
612 612
 
613
-        local IP_ADD=""
613
+        local IP_REPLACE=""
614 614
         local IP_DEL=""
615 615
         local IP_UP=""
616 616
         local DEFAULT_ROUTE_GW
... ...
@@ -635,7 +635,7 @@ function _move_neutron_addresses_route {
635 635
 
636 636
         if [[ "$IP_BRD" != "" ]]; then
637 637
             IP_DEL="sudo ip addr del $IP_BRD dev $from_intf"
638
-            IP_ADD="sudo ip addr add $IP_BRD dev $to_intf"
638
+            IP_REPLACE="sudo ip addr replace $IP_BRD dev $to_intf"
639 639
             IP_UP="sudo ip link set $to_intf up"
640 640
             if [[ "$af" == "inet" ]]; then
641 641
                 IP=$(echo $IP_BRD | awk '{ print $1; exit }' | grep -o -E '(.*)/' | cut -d "/" -f1)
... ...
@@ -645,7 +645,7 @@ function _move_neutron_addresses_route {
645 645
 
646 646
         # The add/del OVS port calls have to happen either before or
647 647
         # after the address is moved in order to not leave it orphaned.
648
-        $DEL_OVS_PORT; $IP_DEL; $IP_ADD; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
648
+        $DEL_OVS_PORT; $IP_DEL; $IP_REPLACE; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
649 649
     fi
650 650
 }
651 651