Fix member_batch_update function to follow api v2
The member_batch_update function signature was missing pool_id parameter. [1] [1] https://docs.openstack.org/octavia/latest/contributor/guides/providers.html Change-Id: I0ac14de29ff92416f103c880bcdc28dd76e00865 Closes-Bug: 1888489
This commit is contained in:
parent
e4f6b8ff8d
commit
57dbca6c5e
@ -273,23 +273,9 @@ class OvnProviderDriver(driver_base.ProviderDriver):
|
|||||||
'info': request_info}
|
'info': request_info}
|
||||||
self._ovn_helper.add_request(request)
|
self._ovn_helper.add_request(request)
|
||||||
|
|
||||||
def member_batch_update(self, members):
|
def member_batch_update(self, pool_id, members):
|
||||||
# Note(rbanerje): all members belong to the same pool.
|
|
||||||
request_list = []
|
request_list = []
|
||||||
skipped_members = []
|
skipped_members = []
|
||||||
pool_id = None
|
|
||||||
try:
|
|
||||||
pool_id = members[0].pool_id
|
|
||||||
except IndexError:
|
|
||||||
msg = _('No member information has been passed')
|
|
||||||
raise driver_exceptions.UnsupportedOptionError(
|
|
||||||
user_fault_string=msg,
|
|
||||||
operator_fault_string=msg)
|
|
||||||
except AttributeError:
|
|
||||||
msg = _('Member does not have proper pool information')
|
|
||||||
raise driver_exceptions.UnsupportedOptionError(
|
|
||||||
user_fault_string=msg,
|
|
||||||
operator_fault_string=msg)
|
|
||||||
pool_key, ovn_lb = self._ovn_helper._find_ovn_lb_by_pool_id(pool_id)
|
pool_key, ovn_lb = self._ovn_helper._find_ovn_lb_by_pool_id(pool_id)
|
||||||
external_ids = copy.deepcopy(ovn_lb.external_ids)
|
external_ids = copy.deepcopy(ovn_lb.external_ids)
|
||||||
existing_members = external_ids[pool_key].split(',')
|
existing_members = external_ids[pool_key].split(',')
|
||||||
|
@ -742,7 +742,7 @@ class TestOvnOctaviaBase(base.TestOVNFunctionalBase,
|
|||||||
pool = self._get_pool_from_lb_data(lb_data, pool_id=pool_id)
|
pool = self._get_pool_from_lb_data(lb_data, pool_id=pool_id)
|
||||||
expected_status = []
|
expected_status = []
|
||||||
self._o_driver_lib.update_loadbalancer_status.reset_mock()
|
self._o_driver_lib.update_loadbalancer_status.reset_mock()
|
||||||
self.ovn_driver.member_batch_update(members)
|
self.ovn_driver.member_batch_update(pool_id, members)
|
||||||
for member in members:
|
for member in members:
|
||||||
expected_status.append(
|
expected_status.append(
|
||||||
{'pools': [{'id': pool.pool_id,
|
{'pools': [{'id': pool.pool_id,
|
||||||
|
@ -285,39 +285,34 @@ class TestOvnProviderDriver(ovn_base.TestOvnOctaviaBase):
|
|||||||
mock_ip_differs.assert_not_called()
|
mock_ip_differs.assert_not_called()
|
||||||
|
|
||||||
def test_member_batch_update(self):
|
def test_member_batch_update(self):
|
||||||
self.driver.member_batch_update([self.ref_member, self.update_member])
|
self.driver.member_batch_update(self.pool_id,
|
||||||
|
[self.ref_member, self.update_member])
|
||||||
self.assertEqual(self.mock_add_request.call_count, 3)
|
self.assertEqual(self.mock_add_request.call_count, 3)
|
||||||
|
|
||||||
def test_member_batch_update_no_members(self):
|
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
|
||||||
self.driver.member_batch_update, [])
|
|
||||||
|
|
||||||
def test_member_batch_update_missing_pool(self):
|
|
||||||
delattr(self.ref_member, 'pool_id')
|
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
|
||||||
self.driver.member_batch_update, [self.ref_member])
|
|
||||||
|
|
||||||
def test_member_batch_update_skipped_monitor(self):
|
def test_member_batch_update_skipped_monitor(self):
|
||||||
self.ref_member.monitor_address = '10.11.1.1'
|
self.ref_member.monitor_address = '10.11.1.1'
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
self.assertRaises(exceptions.UnsupportedOptionError,
|
||||||
self.driver.member_batch_update,
|
self.driver.member_batch_update,
|
||||||
|
self.pool_id,
|
||||||
[self.ref_member])
|
[self.ref_member])
|
||||||
|
|
||||||
def test_member_batch_update_skipped_mixed_ip(self):
|
def test_member_batch_update_skipped_mixed_ip(self):
|
||||||
self.ref_member.address = 'fc00::1'
|
self.ref_member.address = 'fc00::1'
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
self.assertRaises(exceptions.UnsupportedOptionError,
|
||||||
self.driver.member_batch_update,
|
self.driver.member_batch_update,
|
||||||
|
self.pool_id,
|
||||||
[self.ref_member])
|
[self.ref_member])
|
||||||
|
|
||||||
def test_member_batch_update_unset_admin_state_up(self):
|
def test_member_batch_update_unset_admin_state_up(self):
|
||||||
self.ref_member.admin_state_up = data_models.UnsetType()
|
self.ref_member.admin_state_up = data_models.UnsetType()
|
||||||
self.driver.member_batch_update([self.ref_member])
|
self.driver.member_batch_update(self.pool_id, [self.ref_member])
|
||||||
self.assertEqual(self.mock_add_request.call_count, 2)
|
self.assertEqual(self.mock_add_request.call_count, 2)
|
||||||
|
|
||||||
def test_member_batch_update_missing_subnet_id(self):
|
def test_member_batch_update_missing_subnet_id(self):
|
||||||
self.ref_member.subnet_id = None
|
self.ref_member.subnet_id = None
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
self.assertRaises(exceptions.UnsupportedOptionError,
|
||||||
self.driver.member_batch_update, [self.ref_member])
|
self.driver.member_batch_update,
|
||||||
|
self.pool_id, [self.ref_member])
|
||||||
|
|
||||||
def test_member_update_failure(self):
|
def test_member_update_failure(self):
|
||||||
self.assertRaises(exceptions.UnsupportedOptionError,
|
self.assertRaises(exceptions.UnsupportedOptionError,
|
||||||
|
Loading…
Reference in New Issue
Block a user