Fix request to OVN NB DB API
Patch [1] introduces HM to OVN Octavia provider, by error it makes an wrong request to OVN NB DB API when a health_monitor event is received, in order to search the Load Balancer related with the event received. The request is done call using data from members related and the protocol (it is an array). This patch fix that request to be well formed. [1] https://review.opendev.org/c/openstack/ovn-octavia-provider/+/801890 Partial-Bug: #1965772 Change-Id: I1348704a7a0538f570237e9687f5d770159c1392
This commit is contained in:
parent
b28b4bf840
commit
61a56dc377
|
@ -2431,8 +2431,8 @@ class OvnProviderHelper():
|
|||
member_ip = f'[{member_ip}]'
|
||||
mappings[member_ip] = member_src
|
||||
lbs = self.ovn_nbdb_api.db_find_rows(
|
||||
'Load_Balancer', (('ip_port_mappings', '=', mappings),
|
||||
('protocol', '=', row.protocol))).execute()
|
||||
'Load_Balancer', ('ip_port_mappings', '=', mappings),
|
||||
('protocol', '=', row.protocol[0])).execute()
|
||||
return lbs[0] if lbs else None
|
||||
|
||||
def hm_update_event_handler(self, row):
|
||||
|
|
|
@ -3612,9 +3612,9 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
|
|||
self.mock_add_request.assert_called_once_with(expected)
|
||||
self.helper.ovn_nbdb_api.db_find_rows.assert_called_once_with(
|
||||
'Load_Balancer',
|
||||
(('ip_port_mappings', '=',
|
||||
{self.member_address: 'a-logical-port:' + src_ip}),
|
||||
('protocol', '=', self.ovn_hm_lb.protocol)))
|
||||
('ip_port_mappings', '=',
|
||||
{self.member_address: 'a-logical-port:' + src_ip}),
|
||||
('protocol', '=', self.ovn_hm_lb.protocol[0]))
|
||||
|
||||
def test_hm_update_event_lb_not_found(self):
|
||||
self.helper.ovn_nbdb_api.db_find_rows.return_value.\
|
||||
|
|
Loading…
Reference in New Issue