Browse Source

Merge "Fix cluster deletion when load balancers don't exist"

changes/26/765126/2
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
7608579f19
3 changed files with 32 additions and 0 deletions
  1. +2
    -0
      magnum/common/octavia.py
  2. +24
    -0
      magnum/tests/unit/common/test_octavia.py
  3. +6
    -0
      releasenotes/notes/story-2008548-65a571ad15451937.yaml

+ 2
- 0
magnum/common/octavia.py View File

@ -111,6 +111,8 @@ def delete_loadbalancers(context, cluster):
filters={"type": lb_resource_type})
for lb_res in lb_resources:
lb_id = lb_res.physical_resource_id
if not lb_id:
continue
try:
lb = octavia_client.load_balancer_show(lb_id)
lbs.append(lb)


+ 24
- 0
magnum/tests/unit/common/test_octavia.py View File

@ -145,3 +145,27 @@ class OctaviaTest(base.TestCase):
self.context,
self.cluster
)
@mock.patch("magnum.common.neutron.delete_floatingip")
@mock.patch('magnum.common.clients.OpenStackClients')
def test_delete_loadbalancers_already_deleted(self, mock_clients,
mock_delete_fip):
mock_octavia_client = mock.MagicMock()
mock_octavia_client.load_balancer_list.return_value = {
"loadbalancers": []
}
mock_heat_client = mock.MagicMock()
mock_heat_client.resources.list.return_value = [
TestHeatLBResource(None)
]
osc = mock.MagicMock()
mock_clients.return_value = osc
osc.octavia.return_value = mock_octavia_client
osc.heat.return_value = mock_heat_client
octavia.delete_loadbalancers(self.context, self.cluster)
self.assertFalse(mock_octavia_client.load_balancer_show.called)
self.assertFalse(mock_octavia_client.load_balancer_delete.called)

+ 6
- 0
releasenotes/notes/story-2008548-65a571ad15451937.yaml View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue with cluster deletion if load balancers do not exist. See
`story 2008548 <https://storyboard.openstack.org/#!/story/2008548>` for
details.

Loading…
Cancel
Save