From 548d65d1a50612c6b24f85e6ffbdd1cd32bae8e4 Mon Sep 17 00:00:00 2001 From: Fernando Royo Date: Mon, 19 Dec 2022 15:36:41 +0100 Subject: [PATCH] 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 --- ovn_octavia_provider/helper.py | 10 +++++++--- ovn_octavia_provider/tests/unit/test_helper.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ovn_octavia_provider/helper.py b/ovn_octavia_provider/helper.py index 95967ec8..36c03ac6 100644 --- a/ovn_octavia_provider/helper.py +++ b/ovn_octavia_provider/helper.py @@ -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] diff --git a/ovn_octavia_provider/tests/unit/test_helper.py b/ovn_octavia_provider/tests/unit/test_helper.py index 6a05bd7e..1799dde7 100644 --- a/ovn_octavia_provider/tests/unit/test_helper.py +++ b/ovn_octavia_provider/tests/unit/test_helper.py @@ -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')