Browse Source

NSX|P: Fix loadbalancer delete cascade for pools

When the pool is deleted the listeners were already removed.

Change-Id: I742ae44fca3c40fae4b0dc4ad577be57765c59ee
changes/14/762914/1
asarfaty 2 months ago
parent
commit
53e8866ae4
2 changed files with 17 additions and 0 deletions
  1. +5
    -0
      vmware_nsx/services/lbaas/nsx_p/implementation/pool_mgr.py
  2. +12
    -0
      vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py

+ 5
- 0
vmware_nsx/services/lbaas/nsx_p/implementation/pool_mgr.py View File

@ -240,4 +240,9 @@ class EdgePoolManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
completor(success=True)
def delete_cascade(self, context, pool, completor):
# Listeners were already deleted
pool['listeners'] = []
pool['listener'] = None
pool['listener_id'] = None
self.delete(context, pool, completor)

+ 12
- 0
vmware_nsx/tests/unit/services/lbaas/test_nsxp_driver.py View File

@ -1337,6 +1337,18 @@ class TestEdgeLbaasV2Pool(BaseTestEdgeLbaasV2):
self.assertTrue(self.last_completor_called)
self.assertTrue(self.last_completor_succees)
def test_delete_cascade(self):
self.reset_completor()
with mock.patch.object(self.pool_client, 'delete'
) as mock_delete_pool:
self.edge_driver.pool.delete_cascade(
self.context, self.pool_dict,
self.completor)
mock_delete_pool.assert_called_with(LB_POOL_ID)
self.assertTrue(self.last_completor_called)
self.assertTrue(self.last_completor_succees)
def test_delete_with_persistency(self):
with mock.patch.object(self.vs_client, 'get'
) as mock_vs_get, \


Loading…
Cancel
Save