Browse Source

Merge "Check if no members in pool better in batch update" into stable/train

changes/94/772094/9
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
dd6b965d48
2 changed files with 11 additions and 1 deletions
  1. +2
    -1
      networking_ovn/octavia/ovn_driver.py
  2. +9
    -0
      networking_ovn/tests/unit/octavia/test_ovn_driver.py

+ 2
- 1
networking_ovn/octavia/ovn_driver.py View File

@ -2209,7 +2209,8 @@ class OvnProviderDriver(driver_base.ProviderDriver):
skipped_members = []
pool_key, ovn_lb = self._ovn_helper._find_ovn_lb_by_pool_id(pool_id)
external_ids = copy.deepcopy(ovn_lb.external_ids)
existing_members = external_ids[pool_key].split(',')
pool = external_ids[pool_key]
existing_members = pool.split(',') if pool else []
members_to_delete = copy.copy(existing_members)
for member in members:
if (self._check_monitor_options(member) or


+ 9
- 0
networking_ovn/tests/unit/octavia/test_ovn_driver.py View File

@ -392,6 +392,15 @@ class TestOvnProviderDriver(TestOvnOctaviaBase):
[self.ref_member, self.update_member])
self.assertEqual(self.mock_add_request.call_count, 3)
def test_member_batch_update_no_members(self):
pool_key = 'pool_%s' % self.pool_id
ovn_lb = copy.copy(self.ovn_lb)
ovn_lb.external_ids[pool_key] = []
self.mock_find_lb_pool_key.return_value = ovn_lb
self.driver.member_batch_update(self.pool_id,
[self.ref_member, self.update_member])
self.assertEqual(self.mock_add_request.call_count, 2)
def test_member_batch_update_skipped_monitor(self):
self.ref_member.monitor_address = '10.11.1.1'
self.assertRaises(exceptions.UnsupportedOptionError,


Loading…
Cancel
Save