Clean conntrack records when removing floating ip

Established connections via floating ip won't get disconnected after
disassociating.
This patch move clean_conntrack from migration code to remove_floating_ip to
make sure that established connections on floating ip will get interrupted
immediately after disassociating.

Change-Id: I88d258ea39ea7c76e4cc60a636eb1e3e6aaa6f22
Closes-Bug: #1334938
This commit is contained in:
stanzgy 2014-06-27 13:38:09 +08:00
parent b37c4ad695
commit 7028f07420
3 changed files with 2 additions and 8 deletions

View File

@ -570,10 +570,6 @@ class FloatingIP(object):
interface,
fixed_ip.network)
# NOTE(ivoks): Destroy conntrack entries on source compute
# host.
self.l3driver.clean_conntrack(fixed_ip.address)
# NOTE(wenjianhn): Make this address will not be bound to public
# interface when restarts nova-network on dest compute node
floating_ip.host = None

View File

@ -118,6 +118,7 @@ class LinuxNetL3(L3Driver):
linux_net.unbind_floating_ip(floating_ip, l3_interface_id)
linux_net.remove_floating_forward(floating_ip, fixed_ip,
l3_interface_id, network)
linux_net.clean_conntrack(fixed_ip)
def add_vpn(self, public_ip, port, private_ip):
linux_net.ensure_vpn_forward(public_ip, port, private_ip)
@ -127,9 +128,6 @@ class LinuxNetL3(L3Driver):
# the VPN forwarding rules
pass
def clean_conntrack(self, fixed_ip):
linux_net.clean_conntrack(fixed_ip)
def teardown(self):
pass

View File

@ -2688,7 +2688,7 @@ class FloatingIPTestCase(test.TestCase):
fake_is_stale_floating_ip_address)
self.stubs.Set(self.network.l3driver, 'remove_floating_ip',
fake_remove_floating_ip)
self.stubs.Set(self.network.l3driver, 'clean_conntrack',
self.stubs.Set(self.network.driver, 'clean_conntrack',
fake_clean_conntrack)
self.mox.ReplayAll()
addresses = ['172.24.4.23', '172.24.4.24', '172.24.4.25']