Uncouple HM status of member statuses

When a new HM is created, the provisioning status is conditioned
by the status of the existing members on the pool. When any of
the members are in ERROR status (e.g. when a member is configure
with non existing address) the created HM is in ERROR status.

It makes more sense to warn about the member problem but let the
HM continue with its normal flow of operation over the possible
remaining members that exist for the pool on which it is created.
This patch removes the break after finding a problematic member
(port not found) and just log a warning about the issue, but
continue with the rest of the members.

Closes-Bug: #2000071
Change-Id: I5be9130eb63c03d273fc8dfcc93094204a3ed361
(cherry picked from commit 548d65d1a5)
This commit is contained in:
Fernando Royo 2022-12-19 15:36:41 +01:00
parent d8c849d986
commit 21d8f7cc7f
2 changed files with 9 additions and 5 deletions

View File

@ -2310,10 +2310,14 @@ class OvnProviderHelper():
ovn_lb.external_ids[pool_key]):
member_lsp = self._get_member_lsp(member_ip, member_subnet)
if not member_lsp:
LOG.error("Member %(member)s Logical_Switch_Port not found. "
"Cannot create a Health Monitor for pool %(pool)s.",
# NOTE(froyo): In order to continue evaluating the rest of
# the members, we just warn about the member issue,
# assuming that it will be in OFFLINE status as soon as the
# HM does the first evaluation.
LOG.error("Member %(member)s Logical_Switch_Port not found, "
"when creating a Health Monitor for pool %(pool)s.",
{'member': member_ip, 'pool': pool_key})
return False
continue
network_id = member_lsp.external_ids.get(
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY).split('neutron-')[1]

View File

@ -3499,9 +3499,9 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
net_cli.return_value.show_subnet.side_effect = [n_exc.NotFound]
status = self.helper.hm_create(self.health_monitor)
self.assertEqual(status['healthmonitors'][0]['provisioning_status'],
constants.ERROR)
constants.ACTIVE)
self.assertEqual(status['healthmonitors'][0]['operating_status'],
constants.ERROR)
constants.ONLINE)
@mock.patch('ovn_octavia_provider.common.clients.get_neutron_client')
@mock.patch.object(ovn_helper.OvnProviderHelper, '_find_ovn_lb_by_pool_id')