Loading
fix: tolerate agent events with missing host in neutron-ovn-operator
neutron-ovn-operator polls openstack network agents and diffs it against the previous poll, keyed by agent host.
Neutron derives on OVN agent's host from the Southbound DB via Chassis_Private -> Chassis. When these two fall out of sync - for example an ungraceful ovn-controller restart, or because a neutron-server worker's in-memory AgentCache missed an update, which might lead to lookup fails and the task will crash as following:
Before fix
2026-09-01 13:04:19,222 DEBUG yaook.op.daemon dispatching external EventType.DELETED event on object None of type <class 'yaook.statemachine.resources.openstack.NeutronAgentWatcher'>
2026-09-01 13:04:19,223 ERROR yaook.op.tasks.RestartingTask.136077189427024 task crashed! retrying in 1s
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/yaook/op/tasks.py", line 555, in _task_done
result = task.result()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/yaook/op/daemon.py", line 954, in _watch_external
self._dispatch_external_event(api, watcher, ev)
File "/usr/local/lib/python3.11/site-packages/yaook/op/daemon.py", line 1299, in _dispatch_external_event
self._deliver_event(
File "/usr/local/lib/python3.11/site-packages/yaook/op/daemon.py", line 972, in _deliver_event
trigger_reconcile = func(ctx, event)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/yaook/statemachine/resources/openstack.py", line 1169, in _handle_agent_event
if event.object_.host != ctx.parent_name:
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'host'
2026-09-01 13:04:20,227 INFO yaook.op.daemon setting up watcher for <class 'yaook.statemachine.resources.openstack.NeutronAgentWatcher'>This change adds a prober error handling when event.object_ is None or has no host
After fix:
2026-09-01 16:23:30,922 DEBUG yaook.op.daemon dispatching external EventType.DELETED event on object None of type <class 'yaook.statemachine.resources.openstack.NeutronAgentWatcher'>
2026-09-01 16:23:30,922 WARNING yaook.op.daemon Event for object compute02 has no host set. Abort the handling of the event.
2026-09-01 16:23:30,925 DEBUG yaook.op.tasks nothing to do, waiting for something to happen
2026-09-01 16:23:30,925 DEBUG yaook.op.tasks nothing to do, waiting for something to happenEdited by Mohamad Mouselli