)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"a2b8a240609177dc6e08498e1464a0614346d0c4","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1dd7d4df_0f79d23b","updated":"2026-09-16 17:33:12.000000000","message":"thanks for fixing it, instead of raiseing LoopingCallDone() let\u0027s return the value and letoslo.service gracefully stop the periodic task thread.","commit_id":"dfbc62ebdb9a875bff41dfe1fbd8a319fdf9da65"}],"nova/manager.py":[{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"a2b8a240609177dc6e08498e1464a0614346d0c4","unresolved":true,"context_lines":[{"line_number":129,"context_line":"        \"\"\"Tasks to be run at a periodic interval.\"\"\""},{"line_number":130,"context_line":"        if self._shutdown_in_progress.is_set():"},{"line_number":131,"context_line":"            LOG.debug(\u0027Skipping periodic tasks during graceful shutdown.\u0027)"},{"line_number":132,"context_line":"            # We either need to return a value or raise LoopingCallDone"},{"line_number":133,"context_line":"            # to avoid a RuntimeError in DynamicLoopingCall. As we"},{"line_number":134,"context_line":"            # are shutting down, we don\u0027t want to run any periodic tasks any"},{"line_number":135,"context_line":"            # more, so we raise."},{"line_number":136,"context_line":"            raise loopingcall.LoopingCallDone()"},{"line_number":137,"context_line":"        return self.run_periodic_tasks(context, raise_on_error\u003draise_on_error)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def init_host(self, service_ref):"}],"source_content_type":"text/x-python","patch_set":1,"id":"2facdbfa_bb30dd75","line":136,"range":{"start_line":132,"start_character":0,"end_line":136,"end_character":47},"updated":"2026-09-16 17:33:12.000000000","message":"I will say let\u0027s return the value here instead of LoopingCallDone(). Once LoopingCallDone() is raised, oslo.service will stop the periodic tasks dynamic looping call thread. It is fine as we do not need to run any more periodic task but this is odd from graceful shutdown perspective.\n\n- https://github.com/openstack/oslo.service/blob/364aafec725c9b98d23426450bc247d838cba611/oslo_service/backend/_common/loopingcall.py#L198\n\nWhat I understood the LoopingCallDone() main use case is that when we are done with loopingcall means execution finished and not when we want to stop looping calls in between (like shutdown case where we want to stop the periodics tasks bcz we are shutting down).\n\nReturning number can be a good way here from graceful shutdown order:\n- Nova shutdown initiated and it return the idle time from periodic_tasks(), means no more periodic tasks to run but do not  finish thread.\n\n- Nova finish the shutdown and call oslo.sevice.stop()\n  - https://github.com/openstack/nova/blob/94de0576ca02e0668233bedfbe7e18b87316c708/nova/service.py#L475\n\n- oslo.service.stop() gracefully stop the thread (self.tg)\n  - https://github.com/openstack/oslo.service/blob/364aafec725c9b98d23426450bc247d838cba611/oslo_service/backend/_threading/service.py#L306\n  \n  \nfor return value, we can use the defaul idle/spacing time for periodic tasks (60)\n- https://github.com/openstack/oslo.service/blob/364aafec725c9b98d23426450bc247d838cba611/oslo_service/periodic_task.py#L30","commit_id":"dfbc62ebdb9a875bff41dfe1fbd8a319fdf9da65"}]}
