Remove conntrack rule when FIP is deleted

Change-Id: Ia2bc8a7b5b27a5d4fbbfb7813cde7f022934bd22
Closes-Bug: #1818805
(cherry picked from commit 0c6d76f210)
This commit is contained in:
Rodolfo Alonso Hernandez 2019-03-07 18:17:04 +00:00 committed by Swaminathan Vasudevan
parent 1ea1c59805
commit 2eda4ef62e
2 changed files with 10 additions and 1 deletions

View File

@ -183,6 +183,7 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
device = ip_lib.IPDevice(fip_2_rtr_name, namespace=fip_ns_name)
device.route.delete_route(fip_cidr, str(rtr_2_fip.ip))
return device
def floating_ip_moved_dist(self, fip):
"""Handle floating IP move between fixed IPs."""
@ -196,7 +197,9 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
return self.floating_ip_added_dist(fip, ip_cidr)
def remove_floating_ip(self, device, ip_cidr):
self.floating_ip_removed_dist(ip_cidr)
fip_2_rtr_device = self.floating_ip_removed_dist(ip_cidr)
if fip_2_rtr_device:
fip_2_rtr_device.delete_conntrack_state(ip_cidr)
def move_floating_ip(self, fip):
self.floating_ip_moved_dist(fip)

View File

@ -307,7 +307,13 @@ class IPDevice(SubProcessBase):
can also be passed.
"""
self.addr.delete(cidr)
self.delete_conntrack_state(cidr)
def delete_conntrack_state(self, cidr):
"""Delete conntrack state rules
Deletes both rules (if existing), the destination and the reply one.
"""
ip_str = str(netaddr.IPNetwork(cidr).ip)
ip_wrapper = IPWrapper(namespace=self.namespace)