Merge "Remove floatingip address ignores ha_state" into stable/newton
This commit is contained in:
commit
655530c138
|
@ -275,9 +275,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):
|
||||
|
|
|
@ -18,6 +18,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
|
||||
|
@ -100,3 +101,14 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
|||
calls = ["sig='str(%d)'" % signal.SIGTERM,
|
||||
"sig='str(%d)'" % signal.SIGKILL]
|
||||
mock_pm.disable.has_calls(calls)
|
||||
|
||||
@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