Remove floatingip address ignores ha_state
We both enables router_distributed and l3_ha in server side, and configures L3 agent node as dvr_snat in compute nodes. HA router removing floatingip address only in master node, and dvr local router only remove FIP rule. This will cause RTNETLINK error if we operates floatingip "associate --> disassociate --> reassociate". This patch removes floatingip address whether router's ha_state is master or backup. Another solution is adding remove_floating_ip in dvr_edge_router. Change-Id: I2fab45cff786c475d69c5f0cf4e9b71e6bbbe653 Closes-Bug: #1641535
This commit is contained in:
parent
b51c5635ab
commit
b45fd35e3f
@ -272,9 +272,7 @@ class HaRouter(router.RouterInfo):
|
||||
|
||||
def remove_floating_ip(self, device, ip_cidr):
|
||||
self._remove_vip(ip_cidr)
|
||||
if self.ha_state == 'master' and device.addr.list(to=ip_cidr):
|
||||
# Delete the floatingip address from external port only after
|
||||
# the ip address has been configured to the device
|
||||
if device.addr.list(to=ip_cidr):
|
||||
super(HaRouter, self).remove_floating_ip(device, ip_cidr)
|
||||
|
||||
def internal_network_updated(self, interface_name, ip_cidrs):
|
||||
|
@ -16,6 +16,7 @@ import mock
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron.agent.l3 import ha_router
|
||||
from neutron.agent.l3 import router_info
|
||||
from neutron.tests import base
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
@ -72,3 +73,14 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
||||
subnets[1]['gateway_ip'] = None
|
||||
ri._add_default_gw_virtual_route(ex_gw_port, 'qg-abc')
|
||||
self.assertEqual(0, len(mock_instance.virtual_routes.gateway_routes))
|
||||
|
||||
@mock.patch.object(router_info.RouterInfo, 'remove_floating_ip')
|
||||
def test_remove_floating_ip(self, super_remove_floating_ip):
|
||||
ri = self._create_router(mock.MagicMock())
|
||||
mock_instance = mock.Mock()
|
||||
ri._get_keepalived_instance = mock.Mock(return_value=mock_instance)
|
||||
device = mock.Mock()
|
||||
fip_cidr = '15.1.2.3/32'
|
||||
|
||||
ri.remove_floating_ip(device, fip_cidr)
|
||||
self.assertTrue(super_remove_floating_ip.called)
|
||||
|
Loading…
Reference in New Issue
Block a user