Merge "Handle empty delay on update healthmonitor" into stable/2023.2

This commit is contained in:
Zuul 2024-04-16 09:41:57 +00:00 committed by Gerrit Code Review
commit ac5a0470f2
3 changed files with 25 additions and 1 deletions

View File

@ -188,7 +188,9 @@ class HealthMonitorController(base.BaseController):
request.type == consts.HEALTH_MONITOR_UDP_CONNECT)
conf_min_delay = (
CONF.api_settings.udp_connect_min_interval_health_monitor)
if hm_is_type_udp and request.delay < conf_min_delay:
if (hm_is_type_udp and
not isinstance(request.delay, wtypes.UnsetType) and
request.delay < conf_min_delay):
raise exceptions.ValidationException(detail=_(
"The request delay value %(delay)s should be larger than "
"%(conf_min_delay)s for %(type)s health monitor type.") % {

View File

@ -1782,6 +1782,24 @@ class TestHealthMonitor(base.BaseAPITest):
pool_prov_status=constants.PENDING_UPDATE,
hm_prov_status=constants.PENDING_UPDATE)
def test_update_udp_case_with_udp_hm(self):
api_hm = self.create_health_monitor(
self.udp_pool_with_listener_id,
constants.HEALTH_MONITOR_UDP_CONNECT, 3, 1, 1, 1).get(
self.root_tag)
self.set_lb_status(self.udp_lb_id)
new_hm = {'timeout': 2}
self.put(
self.HM_PATH.format(healthmonitor_id=api_hm.get('id')),
self._build_body(new_hm))
self.assert_correct_status(
lb_id=self.udp_lb_id, listener_id=self.udp_listener_id,
pool_id=self.udp_pool_with_listener_id, hm_id=api_hm.get('id'),
lb_prov_status=constants.PENDING_UPDATE,
listener_prov_status=constants.PENDING_UPDATE,
pool_prov_status=constants.PENDING_UPDATE,
hm_prov_status=constants.PENDING_UPDATE)
def test_negative_update_udp_case(self):
api_hm = self.create_health_monitor(
self.udp_pool_with_listener_id,

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixed error on update UDP Health Monitor with empty "delay" parameter