Merge "Fix a bug where ports may not be deleted"
This commit is contained in:
commit
a59ec9b9bd
@ -264,14 +264,14 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
|
||||
|
||||
This can happen if a failover has occurred.
|
||||
"""
|
||||
try:
|
||||
for amphora in six.moves.filter(self._filter_amphora,
|
||||
vip.load_balancer.amphorae):
|
||||
for amphora in six.moves.filter(self._filter_amphora,
|
||||
vip.load_balancer.amphorae):
|
||||
try:
|
||||
self.neutron_client.delete_port(amphora.vrrp_port_id)
|
||||
except (neutron_client_exceptions.NotFound,
|
||||
neutron_client_exceptions.PortNotFoundClient):
|
||||
LOG.debug('VIP instance port {0} already deleted. '
|
||||
'Skipping.'.format(amphora.vrrp_port_id))
|
||||
except (neutron_client_exceptions.NotFound,
|
||||
neutron_client_exceptions.PortNotFoundClient):
|
||||
LOG.debug('VIP instance port {0} already deleted. '
|
||||
'Skipping.'.format(amphora.vrrp_port_id))
|
||||
|
||||
try:
|
||||
port = self.get_port(vip.port_id)
|
||||
|
@ -41,7 +41,6 @@ def generate_load_balancer(vip=None, amphorae=None):
|
||||
amp.load_balancer = lb
|
||||
amp.load_balancer_id = lb.id
|
||||
amp.status = constants.AMPHORA_ALLOCATED
|
||||
amp.vrrp_port_id = 'vrrp_port-{0}-id'.format(VIP_SEED)
|
||||
if vip:
|
||||
vip.load_balancer = lb
|
||||
vip.load_balancer_id = lb.id
|
||||
@ -74,6 +73,7 @@ def generate_amphora(load_balancer=None):
|
||||
status='ACTIVE',
|
||||
lb_network_ip='99.99.99.{0}'.format(AMP_SEED),
|
||||
vrrp_ip='55.55.55.{0}'.format(AMP_SEED),
|
||||
vrrp_port_id='vrrp_port-{0}-id'.format(AMP_SEED),
|
||||
load_balancer=load_balancer)
|
||||
if load_balancer:
|
||||
amp.load_balancer_id = load_balancer.id
|
||||
|
@ -120,7 +120,10 @@ class TestAllowedAddressPairsDriver(base.TestCase):
|
||||
}
|
||||
list_security_groups.return_value = security_groups
|
||||
self.driver.deallocate_vip(vip)
|
||||
delete_port.assert_called_with(vip.port_id)
|
||||
calls = [mock.call(vip.port_id)]
|
||||
for amp in lb.amphorae:
|
||||
calls.append(mock.call(amp.vrrp_port_id))
|
||||
delete_port.assert_has_calls(calls, any_order=True)
|
||||
delete_sec_grp.assert_called_once_with(sec_grp_id)
|
||||
|
||||
def test_deallocate_vip_no_sec_group(self):
|
||||
|
Loading…
Reference in New Issue
Block a user