diff --git a/octavia/api/v2/controllers/health_monitor.py b/octavia/api/v2/controllers/health_monitor.py index 2c8782e954..a1d0a01289 100644 --- a/octavia/api/v2/controllers/health_monitor.py +++ b/octavia/api/v2/controllers/health_monitor.py @@ -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.") % { diff --git a/octavia/tests/functional/api/v2/test_health_monitor.py b/octavia/tests/functional/api/v2/test_health_monitor.py index 62633dfba6..68a662d9f8 100644 --- a/octavia/tests/functional/api/v2/test_health_monitor.py +++ b/octavia/tests/functional/api/v2/test_health_monitor.py @@ -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, diff --git a/releasenotes/notes/Fix-UDP-Health-monitor-update-without-delay-c56240e59e15483f.yaml b/releasenotes/notes/Fix-UDP-Health-monitor-update-without-delay-c56240e59e15483f.yaml new file mode 100644 index 0000000000..40c7450492 --- /dev/null +++ b/releasenotes/notes/Fix-UDP-Health-monitor-update-without-delay-c56240e59e15483f.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed error on update UDP Health Monitor with empty "delay" parameter