Skip to content

Explaining Shaken Fist networking

Shaken Fist networking is complicated, but not as complicated as OpenStack Neutron -- its more like the old OpenStack Compute nova-network implementation if you're looking for a mental model. Let's work through some examples to explain what it is doing.

Asynchronous network deletion (REST API)

DELETE /networks/{network_ref} and DELETE /networks now return HTTP 202 (Accepted) with a cluster-operation handle in the body rather than performing the work synchronously. Operators scripting directly against the REST API (rather than via the Python client) must poll the returned op uuid at GET /clusteroperations/{op_type}/{op_uuid} until the op reaches a terminal state (complete, abort, deleted, or error). The Python client (shakenfist_client) handles this transparently — delete_network() polls by default and raises ClusterOperationFailed on a terminal-error state. See the clusteroperations API reference for the full polling contract.

Single node install, no networks or instances

debian@test:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8950 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:00:00:0e:a3 brd ff:ff:ff:ff:ff:ff
    altname enp0s11
    altname ens11
    inet 10.0.0.74/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
3: egr-br-eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether f6:d1:c6:05:15:fd brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.1/24 scope global egr-br-eth0
       valid_lft forever preferred_lft forever

Explaining this:

  • lo is the loopback interface, and not relevant here.
  • eth0 is the primary interface for the machine, and 10.0.0.74 is the IP address of the machine.
  • egr-br-eth0 is a linux bridge that is currently empty and has the IP 192.168.15.1, which is the first IP on this cluster's floating network. Networks will get attached

Single node install, one network and no instances

Let's make a network, but not put any instances on it yet:

debian@test:~$ sf-client network create demo 172.16.0.0/24
uuid            : 17be6538-8f96-4ccb-b71e-a7e3022fead3
name            : demo
vxlan id        : 14823439
netblock        : 172.16.0.0/24
provide dhcp    : True
provide nat     : True
floating gateway: 192.168.15.194
namespace       : system
state           : created

Metadata:

debian@test:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8950 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:00:00:0e:a3 brd ff:ff:ff:ff:ff:ff
    altname enp0s11
    altname ens11
    inet 10.0.0.74/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
3: egr-br-eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether f6:d1:c6:05:15:fd brd ff:ff:ff:ff:ff:ff
    inet 192.168.15.1/24 scope global egr-br-eth0
       valid_lft forever preferred_lft forever
10: vxlan-e2300f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8900 qdisc noqueue master br-vxlan-e2300f state UNKNOWN group default qlen 1000
    link/ether 6a:c0:ee:6f:83:6f brd ff:ff:ff:ff:ff:ff
11: br-vxlan-e2300f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8900 qdisc noqueue state UP group default qlen 1000
    link/ether 8a:a6:8d:31:c9:09 brd ff:ff:ff:ff:ff:ff
13: veth-e2300f-o@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8900 qdisc noqueue master br-vxlan-e2300f state UP group default qlen 1000
    link/ether 6e:34:bc:25:68:c2 brd ff:ff:ff:ff:ff:ff link-netns 17be6538-8f96-4ccb-b71e-a7e3022fead3
15: egr-e2300f-o@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master egr-br-eth0 state UP group default qlen 1000
    link/ether 5a:9c:f3:eb:2f:bc brd ff:ff:ff:ff:ff:ff link-netns 17be6538-8f96-4ccb-b71e-a7e3022fead3

Here, we allocated a network, which was assigned VXLAN id 14823439 (e2300f in hexadecimal). That created a VXLAN interface named vxlan-e2300f on the machine, which is where other machines in a multinode cluster would attach for the VXLAN mesh which forms our virtual network. br-vxlan-e2300f is a linux bridge used to attach the local network namespace for this network to the VXLAN interface. That is, the members of the bridge look like this:

debian@test:~$ sudo brctl show br-vxlan-e2300f
bridge name         bridge id           STP enabled     interfaces
br-vxlan-e2300f     8000.8aa68d31c909   no              veth-e2300f-o
                                                        vxlan-e2300f

Similarly, the egress bridge egr-br-eth0 now contains a veth as well:

debian@test:~$ sudo brctl show egr-br-eth0
bridge name         bridge id           STP enabled     interfaces
egr-br-eth0         8000.f6d1c60515fd   no              egr-e2300f-o

And there is a linux network namespace named with the UUID of the network:

debian@test:~$ ls /var/run/netns/
17be6538-8f96-4ccb-b71e-a7e3022fead3

That linux network namespace contains the other ends of the veths:

debian@test:~$ sudo ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 ip a
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
12: veth-e2300f-i@if13: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 36:da:87:ea:ce:16 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.16.0.1/24 scope global veth-e2300f-i
       valid_lft forever preferred_lft forever
    inet6 fe80::34da:87ff:feea:ce16/64 scope link
       valid_lft forever preferred_lft forever
14: egr-e2300f-i@if15: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d2:b0:c8:31:f4:83 brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.15.194/24 scope global egr-e2300f-i
       valid_lft forever preferred_lft forever
    inet6 fe80::d0b0:c8ff:fe31:f483/64 scope link
       valid_lft forever preferred_lft forever

This network namespace exists to contain a dnsmasq process providing DHCP to the virtual network, as well as to contain routing and iptables rules for mangling traffic into and out of the virtual network.

Specifically, NAT for traffic from the virtual network to the outside world is implemented with routing and iptables like this:

debian@test:~$ sudo ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 ip route
default via 192.168.15.1 dev egr-e2300f-i
172.16.0.0/24 dev veth-e2300f-i proto kernel scope link src 172.16.0.1
192.168.15.0/24 dev egr-e2300f-i proto kernel scope link src 192.168.15.194

debian@test:~$ sudo ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  172.16.0.0/24        anywhere
MASQUERADE  all  --  172.16.0.0/24        anywhere             ctstate DNAT

So, the default route is via the egress veth at egr-e2300f-i (inside the namespace), which comes out on egr-br-eth0 (outside the namespace) to be routed as normal. Traffic to other machines participating in this virtual network (that is, with the same VXLAN id configured), is routed to veth-e2300f-i (inside the namespace) which comes out on the br-vxlan-e2300f (outside the namespace) bridge which is wired to the linux kernel VXLAN interface at vxlan-e2300f. Finally, traffic to other floating IPs on 192.168.15.0/24 is routed to the egress bridge as well.

The first iptables MASQUERADE entry is there to convert internal addresses to the external 192.168.15.194 "floating gateway" address so instances can talk outside their virtual network. The second one, which only matches connections whose destination has been rewritten, is for floating IP traffic which turns around here instead of leaving -- see the floating IP section below.

Perhaps a diagram would help!

SF single node networking with no instances

Single node install, one network and one instance with no floating IP

Now let's create a single instance on that network, with the instance specifically not having a floating IP:

debian@test:~$ sf-client instance create demo 1 1024 -d 10@debian:11 -n demo
uuid          : 3b9c13ee-405f-4195-b904-cffb34e022d3
...

Interfaces:

    uuid    : afc470fb-8348-4711-8c16-be4c4662d705
    network : 17be6538-8f96-4ccb-b71e-a7e3022fead3
    macaddr : 02:00:00:bd:cd:9b
    order   : 0
    ipv4    : 172.16.0.232
    floating: None
    model   : virtio
...

There is only one new outer network interface created by adding the instance:

debian@test:~$ ip a
...
16: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8900 qdisc noqueue master br-vxlan-e2300f state UNKNOWN group default qlen 1000
    link/ether fe:00:00:bd:cd:9b brd ff:ff:ff:ff:ff:ff

vnet0 is a libvirt construct to attach the virtual machine's network interface to the host OS. We attach that interface to the bridge that is the virtual network for this machine, in this case br-vxlan-e2300f:

debian@test:~$ sudo brctl show br-vxlan-e2300f
bridge name         bridge id           STP enabled     interfaces
br-vxlan-e2300f     8000.8aa68d31c909   no              veth-e2300f-o
                                                        vnet0
                                                        vxlan-e2300f

There are no changes to the inside of the network namespace for this VM -- the dnsmasq process for example is already connected to the virtual network by virtue of the veth-e2300f pair and can therefore provide DHCP to the instance.

Again perhaps a diagram will help:

SF single node networking, one instance with no floating interfaces

This instance is not accessible from outside our virtual network as it does not have a floating IP. It can however talk to the outside world because our virtual network has NAT enabled. This is done by routing the traffic from vnet0 to the virtual network's network namespace, where the iptables MASQUERADE rule will then NAT the traffic out.

We can show this NAT traffic like this:

SF single node networking, one instance with no floating interfaces showing NAT path

Single node install, one network and one instance with no floating IP

Let's add a second instance, but this time with a floating IP associated with it:

debian@test:~$ sf-client instance create floatingdemo 1 1024 -d 10@debian:11 -f demo
uuid          : 08c0ae07-6a4b-4f63-9d50-a172039091a0
...

Interfaces:

    uuid    : a4cfa174-cce9-4cda-907a-b90d7f54efd1
    network : 17be6538-8f96-4ccb-b71e-a7e3022fead3
    macaddr : 02:00:00:c7:f9:cc
    order   : 0
    ipv4    : 172.16.0.37
    floating: 192.168.15.29
    model   : virtio
...

Again we add a vnet device via libvirt:

debian@test:~$ ip a
...
17: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8900 qdisc noqueue master br-vxlan-e2300f state UNKNOWN group default qlen 1000
    link/ether fe:00:00:c7:f9:cc brd ff:ff:ff:ff:ff:ff
19: flt-c0a80f1d@if18: <BROADCAST,MULTICAST> mtu 8900 qdisc noop state DOWN group default qlen 1000
    link/ether aa:5c:1c:0c:7c:f6 brd ff:ff:ff:ff:ff:ff link-netns 17be6538-8f96-4ccb-b71e-a7e3022fead3

But we've also added another veth pair, this time named flt-c0a80f1d on the outside of the network namespace. You can see in the instance details above that the floating IP associated with this instance is 192.168.15.29, which just so happens to be c0a80f1d in hexadecimal. So this veth is how floating IP traffic is delivered to an instance.

Here's another diagram showing the new setup:

SF single node networking, two instances with one having a floating IP

Its important to note that traffic from the instance still goes via the NAT route shown above, while traffic to the instance via the floating IP uses this veth. Replies to floating IP requests return via this veth as well though.

The instance isn't aware of its floating IP at an operating system level at all. That is, inside the network namespace the veth attaches to, we do DNAT to mangle the traffic to the instance:

debian@test:~$ sudo ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DNAT       all  --  anywhere             192.168.15.29        to:172.16.0.37

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  172.16.0.0/24        anywhere
MASQUERADE  all  --  172.16.0.0/24        anywhere             ctstate DNAT

So our floating IP of 192.168.15.29 is DNAT'ed to the instance's IP of 172.16.0.37. This means floating IP traffic "bounces" off the network namespace.

The second MASQUERADE rule above handles the case where the client is itself an instance on the same virtual network. That traffic is DNAT'ed by the same rule and then sent straight back out the veth it arrived on, so the reply would travel directly over the virtual network's own layer 2 and never return through the namespace -- which means it would never have its source rewritten back to the floating address, and the client would discard it. Masquerading those u-turned connections to the network's gateway address puts the namespace back on the return path, where conntrack can undo the destination rewrite.

The two matches on that rule each exclude something different, and both are needed. The -s match confines the rule to connections which started inside the virtual network, which is what preserves the real source address for clients outside the cluster -- their traffic is DNAT'ed here too, so without -s it would be masqueraded as well. The --ctstate DNAT match confines the rule to connections whose destination was rewritten, which is what excludes a routed IP turning around in the same namespace, since a routed IP is never DNAT'ed and its whole point is that it arrives unrewritten.

The cost is that the instance holding the floating IP sees such a connection as coming from the network's gateway rather than from the calling instance; if the destination needs to know who is calling, use a routed IP, which is not rewritten at all.

The network daemon's maintenance pass checks each cycle that this rule is present in the namespace, and rebuilds the network on the network node if it is not. That check is how a cluster which was upgraded while all of its networks were healthy acquires the rule at all -- nothing else re-runs the namespace's iptables setup for a network which is otherwise working.

--ctstate DNAT means a network node now needs the iptables conntrack match (xt_conntrack, which is present in any stock Ubuntu or Debian kernel and is what iptables -m conntrack loads). This is a hard requirement rather than a degradation: a node which cannot install the rule fails the whole enable_nat step, so a NAT-providing network will not come up there at all rather than coming up without in-network floating IPs. The error reported against the failed operation carries iptables' own complaint about the rule it refused.

To make the DNAT bounce work, the inside of the veth is configured with the floating IP:

debian@test:~$ sudo ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 ip a
...
18: flt-c0a80f1d-i@if19: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether fe:cb:4c:4a:17:ef brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.15.29/32 scope global flt-c0a80f1d-i
       valid_lft forever preferred_lft forever

Note the /32 netmask for that address assignment. Notably, the routing table for the outer linux still looks like this:

debian@test:~$ ip route
default via 10.0.0.1 dev eth0
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.74
192.168.15.0/24 dev egr-br-eth0 proto kernel scope link src 192.168.15.1

The outer linux knows to route the floating IP down that veth because of this address assigned on the inside of the namespace.

Let's have a final diagram showing how a packet for a floating IP gets to its instance:

SF single node networking, two instances with one having a floating IP showing ingress path

Multiple nodes

Its actually a relatively small step from the above to multiple hypervisor nodes, as additional nodes don't have the network namespace or the veths -- those exist only on the network node (node 1 in our example).

SF multinode networking

Routed IPs

Shaken Fist v0.8 introduced the concept of routed IPs to support Kubernetes services in the K3S orchestration support. A routed IP is an address from the floating address pool which uses routing to deliver traffic to the relevant virtual network. An interface on the virtual network must then have been configured by the user to answer ARP requests for that address. This works well with metallb, which our K3S orchestration uses to expose services, but would work equally well for other traffic.

Tip

The fundamental difference between a floating IP and a routed IP is whether the destination of the traffic inside the virtual network is aware of the address. A floating IP is packet mangled on its way to an interface so that the interface can't tell that the traffic was sent to a floating IP. On the other hand, an interface with a routed address can tell that the traffic was intended for a specific floating IP, but in return must have been configured to use that floating IP.

The implementation of routed IPs is relatively trivial. For each routed IP, two routes are created on the network node, one in each of the two routing tables which decide where the address's traffic goes.

The first is in the network node's own routing table, and is how traffic from outside the cluster arrives. It puts the address onto the virtual network's bridge, where whichever interface was configured to answer ARP for it picks it up:

ip route replace 192.168.15.29/32 dev br-vxlan-e2300f

The second is inside the virtual network's own network namespace, and is how an instance on that network reaches the address:

ip netns exec 17be6538-8f96-4ccb-b71e-a7e3022fead3 \
    ip route replace 192.168.15.29/32 dev veth-e2300f-i

That second route is needed because a routed IP comes from the floating pool, and as the routing table above shows, the namespace has the whole floating block on link on its egress veth. Without a more specific route an instance's packet reaches its default gateway and the namespace then ARPs for the address out on the egress bridge, where nothing answers -- unlike a floating IP, a routed IP is not configured on an interface anywhere on the network node, it exists only as a route. The /32 turns that into a u-turn back into the network, which is the same delivery the network node performs for everybody else, and it means a routed address behaves identically whether the client is on the virtual network the address is routed to, or outside the cluster entirely (github issue #3662).

A client on a different Shaken Fist virtual network is not covered by either route, and remains unsupported. That namespace also has the whole floating block on link on its egress veth, so it ARPs for the routed address on the egress bridge -- and unlike a floating IP, which the namespace owning it answers for from its egress veth, a routed IP is configured on no interface there and nothing replies. Reach a routed address from another virtual network the same way anything outside the cluster does, by way of the network node.

Both routes use ip route replace rather than ip route add because they are re-applied: the network daemon's maintenance pass restores a network's routed addresses whenever it rebuilds the network on the network node, and also checks each maintenance pass that both routes are still there -- the one in the root namespace and the one inside the network's namespace. An address missing either is re-routed, which installs both, so a network which is otherwise healthy is not dragged through a rebuild to recover one route. Removing a routed IP deletes both routes, and tolerates either being absent.

Reserved addresses

Shaken Fist hands out addresses from a network's block at random, and it only knows about the addresses it allocated itself. An address a guest configures without asking -- a keepalived or VRRP virtual IP shared between instances, a load balancer address written into a deployment's configuration file -- is free as far as IPAM is concerned, so sooner or later it will be allocated to an interface and two things will answer for it.

Reserve it instead:

debian@test:~$ sf-client network reserve-address demo 172.16.0.3 \
                   --comment "kolla VIP"
debian@test:~$ sf-client network addresses demo
address      type     user                                          comment
172.16.0.0   network  network 17be6538-8f96-4ccb-b71e-a7e3022fead3
172.16.0.1   gateway  network 17be6538-8f96-4ccb-b71e-a7e3022fead3
172.16.0.3   manual   network 17be6538-8f96-4ccb-b71e-a7e3022fead3  kolla VIP
172.16.0.255 broadcast network 17be6538-8f96-4ccb-b71e-a7e3022fead3

A manual reservation takes the address out of the pool and does nothing else: no interface is created, dnsmasq is not told about it, and no traffic is routed. Shaken Fist is recording that something it does not manage owns the address, so that nothing else is given it. It is therefore also the one reservation type nothing releases implicitly -- an instance's address returns to the pool when the instance goes away, but a manual reservation is held until it is released:

debian@test:~$ sf-client network release-address demo 172.16.0.3

Released addresses go to the deletion halo like any other, so the address is not immediately re-allocatable. A reservation for an address which is already in use is refused rather than taking it over, and only a manual reservation can be released this way -- asking to release a gateway or an instance's address is refused, because handing that address out again while it is still in use is exactly the collision this exists to prevent.

An administrator can reserve in the floating network too, which is how you hold a floating address for a device Shaken Fist does not manage -- a hardware load balancer, or a router's virtual IP. The floating IP reaper releases floating addresses whose owner has gone away, and a manual reservation has no owner in the cluster by definition, so it is protected there explicitly: nothing but an explicit release will free it.

Interface naming conventions

The interface names in the examples above are a contract, not a coincidence: the privexec daemon derives them independently when adding and when removing resources, so the add and remove paths must agree on the names or removal silently does nothing. Exactly that happened when the floating IP add path dropped the -o suffix from the outer veth end but the removal path kept looking for it -- every floating IP release leaked its veth pair and DNAT rule, and reuse of those floating IPs then failed or misdirected traffic (github issues #3378 through #3383).

All names are derived either from the network's VXLAN id as six lower case hex digits (e2300f for VXLAN id 14823439 in the examples above), or from the floating IPv4 address as eight lower case hex digits (c0a80f1d for 192.168.15.29). Linux limits interface names to 15 characters, which these conventions exactly fill in the worst case.

On the network node:

Name Where Purpose
vxlan-<vxid> root namespace VXLAN mesh interface for the virtual network
br-vxlan-<vxid> root namespace bridge joining the VXLAN interface, instance taps and the namespace veth
veth-<vxid>-o / veth-<vxid>-i root namespace / network namespace veth pair attaching the network namespace to br-vxlan-<vxid>; the inner end holds the virtual network gateway address and serves DHCP
egr-<vxid>-o / egr-<vxid>-i root namespace / network namespace veth pair attaching the network namespace to the egress bridge for NAT and floating traffic
flt-<hex ip> / flt-<hex ip>-i root namespace / network namespace veth pair delivering traffic for one floating IP; the inner end holds the floating address as a /32
egr-br-<nic> root namespace egress bridge on the physical egress NIC, holding the first address of the floating network

The network namespace itself is named with the UUID of the virtual network. Note the asymmetry for floating veth pairs: the outer end has no suffix (not -o), while the inner end is suffixed -i. Each floating IP also has a DNAT PREROUTING rule inside the network namespace directing the floating address to the instance's inner address.

Hypervisor nodes which are not the network node only carry vxlan-<vxid>, br-vxlan-<vxid> and the instance tap devices.

These conventions are asserted by the unit tests in shakenfist/tests/test_privexec_floating_ip.py and exercised end to end by TestFloatingIPLifecycle in the cluster CI suite. If you change a name, change it in the add path, the remove path, the tests, this page and docs/components/cloudgood/networking-shakenfist.md together.

Telling instances their network has failed

A network which cannot be brought up, or whose reconciliation the circuit breaker has quiesced, records that on the network. The instances attached to it have no working network, and until recently had no way for their owner to find out: they read created and healthy, and the only trace was on an object the owner may not think to look at.

Both paths now record a network this instance is attached to has failed event on every instance holding an interface on that network, carrying the network's uuid and the reason, so an operator reading an instance's events can see what happened without first knowing to go and read the network.

It is an event, not a state change. The instance has not failed — its guest is running and its disks are fine — so erroring it would be a lie, and would make it awkward to delete for a condition which may clear on its own.

Two paths signal, and they are rate limited differently:

  • A network entering an error state signals once, on the way in. A network already in an error state has told its instances, and repeating it on every subsequent transition between error states would be noise.
  • A network the maintenance pass quiesces signals once per episode. That branch is reached every 30 seconds for as long as the network stays quiesced, so the episode is tracked and cleared when the network next reconciles cleanly. A network which breaks again is reported again.

Checking that dnsmasq is actually serving

The network node's maintenance pass asks two separate questions about each network's dnsmasq, and the distinction matters.

The first is liveness: is the process still there? That reads the pid file and checks the process exists. It catches a dnsmasq which crashed or was killed, and nothing else — a process which is alive but no longer answering passes it, and the network reads as healthy while its guests cannot get a lease.

The second is readiness: is it still answering DHCP? The pass sends a DHCPINFORM from inside the network's namespace and waits for a DHCPACK. Three things make that the right request to send, each measured against a real dnsmasq configured the way Shaken Fist configures one rather than assumed:

  • It is answered for a client the server has never heard of. A DHCPDISCOVER is not — networks are configured dhcp-range=...,static, so dnsmasq ignores a client which is not in its hosts file, and a DISCOVER probe would have reported every healthy network as broken.
  • It allocates nothing. The reply carries yiaddr 0.0.0.0 and the lease file is untouched, so the probe can run every pass without consuming addresses or disturbing a real client.
  • A wedged dnsmasq fails it. With the process stopped but still present — state T, which the liveness check reports as healthy — the probe times out.

A fourth was measured because a review doubted it: dnsmasq sends its answer to a DHCPINFORM back to the address and port the request came from, not to the DHCP client port (68), so the probe needs no privileged bind. That held on dnsmasq 2.90 (Debian 12) and 2.91 (Ubuntu 24.04 and Debian 13), it is what dhcp_packet() in dnsmasq's src/dhcp.c says it does, and tools/dhcp-probe-against-dnsmasq.sh repeats the measurement in a container. The smoke CI suite also runs the probe against the real dnsmasq on its network node.

Liveness is asked first, because there is no point sending a packet to a process which is not there, and it is far cheaper than a round trip.

A network which fails either check is not okay, and the maintenance pass rebuilds it. DHCP_PROBE_TIMEOUT (default 2 seconds) is how long the probe waits. Within that it sends the DHCPINFORM three times, evenly spaced, as a real DHCP client retransmits: a single datagram dropped by a busy node must not get a healthy network rebuilt. A healthy server answers in milliseconds over a namespace-local round trip, so this is a wedge detector rather than a latency budget: raising it delays detection, and lowering it risks calling a loaded network node broken and rebuilding its networks.

A network which provides DNS but not DHCP is not probed. There is no DHCP readiness to check, and reporting such a network unhealthy would rebuild it on every pass.

The events to look for on a network are network not ok, dnsmasq not running (liveness) and network not ok, dnsmasq not answering DHCP (readiness). The second is the one which used to be invisible.

A probe which ran and was answered records dnsmasq is answering DHCP, once when a network starts being answered and again after any episode of not being answered -- never once per pass, which for every healthy network would be an event row every thirty seconds saying what the first one said. It is the positive half of the pair above, and it exists because nothing else distinguishes a healthy network from one whose probe was never reached: an is_okay() gate which stops calling the probe, or a network refreshed inside the maintain pass's skip window, records no failure at all. Operationally it is the event which says readiness is actually being checked; in CI it is what the readiness test waits for, instead of waiting out a window and passing because nothing complained.

A probe which could not be run at all is a third outcome, and is not treated as either. If the network node cannot reach sf-privexec, or the probe exits with anything but its own "no answer" status, the network records could not check whether dnsmasq is answering DHCP with the error and is left alone. A probe which cannot run says nothing about dnsmasq, and rebuilding every network because the check itself was broken would be worse than not checking. The event is recorded once when the probe starts failing, and can check whether dnsmasq is answering DHCP again once when it recovers; in between, the network node logs a Could not check whether dnsmasq is answering DHCP warning on every pass, so a probe which never runs does not go unnoticed without writing an event row per network every thirty seconds.

The probe reports that third outcome, rather than "no answer", when the namespace's loopback interface is down. The address it asks is the network's own router address, so the request is delivered over loopback, and a down loopback drops a packet rather than refusing to send it: the send succeeds and nothing arrives. A namespace created by ip netns add has its loopback down, which is why creating a network now brings it up. Before that, every DHCP network on a node reported its own undelivered request as a wedged dnsmasq and was queued for a rebuild on every pass.

A namespace built by an earlier version still has its loopback down, and since a probe which cannot run leaves the network alone, nothing would rebuild it. So the probe reports a down loopback with a status of its own, and the maintenance pass brings the loopback up and probes again, without a rebuild. The network records brought the network namespace loopback interface up when it does. If the loopback cannot be brought up, that is reported like any other probe which could not run.

What a maintenance pass costs

The maintenance pass runs every 30 seconds, and the work it does grows with the number of networks the node is on. On a hypervisor that is the networks it has instances for; on the network node it is every active network in the cluster, whether or not anything is using it.

Most of that cost is the per-network health checks, and on the network node the most expensive of those is the DHCP readiness probe described above: it starts an interpreter through sf-privexec inside the network's namespace and waits for an answer, with DHCP_PROBE_TIMEOUT (2 seconds by default) as its worst case. A healthy network answers in well under that. A wedged dnsmasq, or a namespace the probe cannot reach, costs the full timeout. The probes run one network at a time.

So the pass has two cost regimes, and the difference between them is large: a node whose networks are all healthy pays tens of milliseconds each -- four execs, one of them the probe's interpreter start, plus a few database reads, more on a network with many guests because the vxlan mesh audit looks up where each of them is -- while a node in the middle of an incident affecting many dnsmasq processes at once pays the timeout for each affected network. A few hundred networks in the second state is more than the 30 second cadence allows for.

Every pass which runs therefore logs what it cost:

Maintenance pass complete; health_check_seconds=5.84; networks=112; networks_deferred=0; networks_with_guests=40; pass_seconds=6.31
  • networks is how many networks the pass health checked. health_check_seconds divided by it is what one health check costs on this node, which is the figure to size the budget below against. networks and networks_deferred together cover only the networks the pass reached the health check for: a network in delete_wait, or one whose state changed in the last minute, is in neither, so the two can sum to less than the number of networks the node is on.
  • health_check_seconds is the wall time inside those checks, summed. This is the term which grows with network count.
  • networks_deferred is how many networks the pass did not reach because it spent its health check budget (see below).
  • networks_with_guests is how many networks had an interface attached when the pass started, which is what puts a network first in the health check order. It is read from the database once per pass, and a failed read leaves it at zero: a zero against a node with guests means that pass fell back to longest-waiting order. It is absent on a hypervisor, whose networks all have its own guests on them, and when the budget is disabled, because in either case the order decides nothing and the read is not made.
  • pass_seconds is the whole pass, through to the stray vxlan handling at its end. The difference between it and health_check_seconds is everything the bound does not cover: the pass's fixed cost, the per-network work listed under Bounding the health checks below, any reconciliations it enqueued and the stray vxlan handling.

A pass skipped because the network queues are already backed up (see MAINTAIN_QUEUE_DEPTH_THRESHOLD) does no work and logs no cost line; it records a maintain pass skipped event against the node instead, so a gap in the log stream has its explanation in the node's events.

These are log lines rather than events deliberately: a pass runs twice a minute for the life of the node, and an event row at that rate would say nothing the first one said. Reconstruct pass duration against network count from the log stream.

The one case which is an event is a pass slower than its own interval, recorded against the node:

maintain pass took 47.2 seconds, longer than its 30 second interval

That is worth acting on, because the pass's own sleep cannot claw the time back: every repair the next pass would have made is late by the overrun. If you see it, the log line's health_check_seconds says whether the cost is in the health checks (and so in the probes, and so most likely in how many networks are unwell) or elsewhere.

Bounding the health checks

MAINTAIN_HEALTH_CHECK_BUDGET_SECONDS (10 seconds by default, a third of the interval) is how long one pass spends health checking before it stops starting new checks and defers the rest to a later pass. The budget is tested before each check, so a pass can overshoot it by the one check it started last -- at worst a DHCP probe timeout and a mesh audit. That is the right way round: testing afterwards would starve the last network. Setting the budget to zero disables the bound.

At tens of milliseconds per healthy network, the default reaches somewhere between one and a few hundred networks per pass, depending on the node and on how many guests the networks have. A network node on fewer networks than that never reaches the bound while it is well. One on more defers some of them every pass even when nothing is wrong, and reaches each of them over several passes -- the networks with guests on every pass, the empty ones in rotation. That is the bound keeping the pass inside its cadence, which is its job; if you would rather every network were checked every pass and pass_seconds leaves the room, raise the budget towards the interval. What the bound is chiefly for is the degraded case, where enough unreachable dnsmasq processes to spend 2 seconds each would otherwise take the pass past its own cadence.

The bound covers the health checks and nothing else, so it caps the probes rather than the pass. Per-network work outside it, which grows with network count and is in pass_seconds but not health_check_seconds:

  • every network, deferred or not, is loaded from the database before the pass decides whether to defer it;
  • a delete_wait network is checked for a pending operation before a delete is enqueued for it;
  • a checked network which shows drift, or which has routed addresses, is checked for a pending operation; and a healthy network with routed addresses has its routes read from the host, two commands per network per pass, to find a missing one.

On a badly degraded node with many drifted networks those can still take the pass past its interval while the budget is doing its job, so the overrun event below remains possible with the bound enabled.

Networks with an interface attached are checked first, then the longest-waiting, so within each of those two groups the bound defers work rather than starving it: the networks a pass did not reach are the ones the next pass starts with. If the networks with interfaces alone exhaust the budget, empty networks go unchecked for as long as that lasts -- the trade described below. A network deferred this way is still counted as one this node is on, so it is not mistaken for a stray and reaped while it waits.

Deferring a network defers all of its reconciliation, not just its health check. Without a check there is nothing to say a repair is needed, so a deferred network has no network rebuild, no vxlan mesh repair and no routed address route restored this pass; all of that waits for the pass which reaches it.

Preferring networks which have guests on them is what makes a large number of unused networks close to free for the network node. It only decides anything when the budget is scarce -- on a node the budget reaches every network of, every network is checked every pass -- and when it is scarce, an empty network has nothing which can fail to get a DHCP lease, so it is the right thing to go without. Which networks have interfaces is one read of the table per pass, not one per network.

When a pass starts deferring, it says so against the node:

maintain pass spent its 10.0 second health check budget and deferred 37 networks to a later pass; further passes which defer are logged but not reported again until one reaches every network

A degraded node usually defers for many passes in a row, so this is reported once on the way in, and once more on the way out (maintain pass reached every network inside its health check budget again). The passes in between are in the log stream with their networks_deferred count.

Unlike the overrun event this is not in itself a fault -- the bound working is the pass declining to overrun. It does mean some networks went unchecked, so drift on them is repaired a pass or more later than it otherwise would be, as described above. Seeing it on a healthy cluster means the node is on more networks than the budget reaches, which is a choice between rotating through them and raising the budget; seeing it during an incident is the bound doing its job.

Stray vxlan reaping

Which networks a node should be carrying is a closed question: a network is present on a node if and only if that node hosts an instance on it, or the node is the network node, which always carries every network for DHCP and NAT. Everything else is residue, and the invariant is what makes a leak detectable rather than a judgement call -- stale vxlan plumbing stranded on a hypervisor an instance has left is the leak class this reaping exists for, and the cluster suite's network lifecycle test asserts the same invariant from the outside.

The invariant says what a node should carry, not what the maintainer deletes, and the deletion side is deliberately more conservative. An instance which is still building, or which has errored but whose domain may still be running, protects its vxlan even though maintenance does not reconcile its network (_local_instance_vxids() in shakenfist/daemons/network/maintain.py), and a stray must outlive a grace period before anything acts on it. A vxlan belonging to an instance in either state is therefore not a leak.

Every node's network maintainer compares the vxlan devices actually present on the host against the networks that node should be carrying. A device which matches nothing is a stray -- residue from a network teardown which did not finish, or from a network which has since been hard deleted entirely.

Once a stray has been present for MAINTAIN_STRAY_VXLAN_GRACE_SECONDS (default 300) the maintainer acts on it:

  • If no networks row claims the vxid at all, the maintainer deletes br-vxlan-<vxid>, veth-<vxid>-o, egr-<vxid>-o and vxlan-<vxid> itself, and records a reaped stray vxlan audit event on the node. The extra field of that event names the devices which were actually removed, and the message says why the vxid was considered reapable. If some devices were removed but others could not be deleted, the event is partially reaped stray vxlan instead and extra carries a failed list alongside devices; the remaining devices are retried after another grace period.
  • If the network still exists but no instance on this hypervisor uses it, the maintainer enqueues an ordinary network teardown operation for that network on that node instead of touching the devices itself, and records an enqueued teardown of stray vxlan audit event.
  • Otherwise the stray is left alone and logged once per episode. It is not re-logged on every pass -- it used to be, which on a busy cluster produced thousands of identical Extra vxlan present! lines per day (github issue #3597).

Before either of the first two outcomes touches anything, the maintainer also asks the host itself: if a device it did not create -- a guest's tap interface -- is still enslaved to br-vxlan-<vxid>, then a virtual machine is attached to that bridge right now whatever the database says, and the stray is protected and logged instead. If that question cannot be answered at all, the stray is likewise protected.

A bridge which does not exist is an answer to that question, not a failure to answer it -- nothing can be attached to a bridge which is not there. This matters because teardown deletes br-vxlan-<vxid> before vxlan-<vxid>, so a teardown which was interrupted leaves the vxlan interface behind with no bridge. That is the most common stray shape there is, and treating it as unanswerable would protect exactly the residue this reaping exists to remove.

All three audit events are worth watching for. None is an error on its own -- the maintainer is doing the job it exists to do -- but a node producing them repeatedly is a node where network teardown is failing somewhere upstream, and that is worth investigating. Note that a partially reaped stray vxlan event fires once per stray episode, not once per retry: later attempts on the surviving devices are silent until one succeeds. A partially reaped stray vxlan with no follow-up reaped stray vxlan therefore means a device on that host will not go away, which usually needs manual attention.

A reap on the network node implies manual cleanup. The devices listed above are all named from the VXLAN id, so the maintainer can find them without the network object. The network namespace, and the NAT and DNAT rules inside it, are named from the network uuid -- which is exactly what has been lost by the time a reap happens. They are therefore not cleaned up, and once the vxlan devices are gone nothing in Shaken Fist will report them again. Previously the never-ending Extra vxlan present! warning was, in effect, the standing notification that this residue existed; now the single audit event is the only record, so if you see a reaped stray vxlan event on your network node, check for a leftover namespace:

sudo ip netns list

Namespaces are named with the virtual network's UUID, so any name which does not correspond to a network in sf-client network list is residue and can be removed with sudo ip netns delete <uuid>.

Dispatcher diagnostic events

Operators reading the event log for a cluster operation will see two events emitted directly by the queue dispatcher and one emitted at enqueue time (in addition to the operation-specific audit and mutate events emitted by the operation itself). The enqueue-side dedup event is emitted by the enqueuing process, not by the dispatcher:

  • execution duration (EVENT_TYPE_USAGE). Emitted when the dispatcher finishes running an op. Carries these fields in extra:

    • seconds — wall-clock time spent inside op.execute() (state writes, coalescing fold, the _apply_* work, the terminal state write).
    • wait_seconds — time between when the op was first inserted into cluster_operations and when the dispatcher began executing it. Note that this runs to the start of execution, not to the claim: the two differ by however long the daemon held the item after claiming it, which is what dispatch_seconds below separates out. This is not queueing alone: it also counts deliberate deferral while an op waits on a dependency, and the seconds a *_high_io background op spends gated off while the local disk is busy. Both are designed behaviour, and each is large enough to be the whole of a tail on its own -- the worst operation type measured for the queue-performance plan had a 15.78 s median wait which fell to 0.77 s once deferred ops were excluded. So read a large value against defer_count and against the node's disk busy metric before calling it a backup; only once those are excluded does it point at worker saturation or a stuck op blocking the worker. See "Reading these events back" below.
    • defer_count — how many times this op was re-enqueued via defer() / defer_with_backoff() before finally running. A first-time pickup is 0; non-zero values indicate dependency waits or transient retries.
    • queue_name — the queue the op was claimed from. Useful for attributing wait time to a specific priority lane (e.g. networknode-clusteroperation-user_facing_high_io).
    • dequeued_at, queue_seconds and dispatch_seconds — when the dispatcher's claim returned this item, and the two halves wait_seconds divides into: queue_seconds is time the row sat in the database queue unclaimed, and dispatch_seconds is time this daemon held it after claiming it. They sum to wait_seconds. dispatch_seconds is read from one node's clock at both ends; queue_seconds is measured from the operation's creation time, which may have been taken on another node, so it carries any clock skew between the two. A negative queue_seconds is that skew rather than a measurement to act on.

    This is the distinction that matters when a wait is long and defer_count is zero, which is most of them: over nine in ten of the waits of fifteen seconds or more never deferred once, and an operation which never defers emits no intermediate events, so its whole wait used to be a single bracket with nothing inside it. With defer_count zero, a large queue_seconds means nobody asked for that queue -- it sits low in the dispatcher's priority order and higher lanes filled every batch. Where defer_count is non-zero, the deferral sleep is counted in queue_seconds too, because the wait is measured from the operation's creation. A large dispatch_seconds means the daemon had the item and sat on it, which on sf-net usually means one slow operation ahead of it on the same partitioned worker, since ops for one target are routed to one worker thread and run serially.

    Absent on events from a build before this existed, and from a dispatcher talking to an sf-database which does not report the claim. * deliveries — how many times this work item has been handed to a worker, this delivery included, so a first delivery is 1. Anything higher means an earlier delivery did not resolve the item: a worker which crashed or was lost holding it, which the cluster's stuck-row reaper later gave back. defer_count counts deliberate deferrals only, so without this a redelivery reads exactly like a first attempt. Absent when the sf-database answering the claim is too old to report it, rather than reported as 1.

The combined event replaces an earlier split into separate 'started executing' and 'execution duration' events. The combined form halves the eventlog gRPC cost on the dispatcher's critical path -- profiling identified that cost as the largest per-op overhead added during the queue-performance work. Ops loaded outside the dispatch path (unit tests, REST endpoints) still emit 'execution duration' with seconds only; the wait fields are populated only when the dispatcher set the hints.

The same event also carries the coalescing instrumentation, when the operation reached the cross-op fold's guards at all: * coalesce_outcome — ran if the fold's SQL was issued, or which guard skipped it: batch_size_one (the dispatcher dequeued only this op), key_cannot_distinguish_queue (the operation's coalescing key cannot tell its work apart from work on another queue, so folding would be unsafe -- reported as not_cluster_wide by builds before the key became multi-column), type_not_coalescible (this operation type declares no coalescing at all, which is every cluster operation that is not a net_op and so most of them) key_column_missing (the coalescing key names a column the operation does not have; the fold is skipped, an error is logged, and this is a mis-declaration rather than a runtime condition), coalescing_unavailable (the fold was attempted but the sf-database on the other end predates the coalescing RPCs; this is what you see during a rolling upgrade, the op still runs and only the optimisation is lost until the upgrade finishes) or no_coalescible_tasks (a type which could have coalesced, carrying nothing coalescible this time). type_not_coalescible and no_coalescible_tasks are separate outcomes on purpose: merged, the boring case buries the interesting one. * coalesce_seconds — cost of the fold_coalescible_siblings call, present when the call was attempted: outcomes ran and coalescing_unavailable. Measured with a monotonic clock, so it is an interval rather than a difference of two wall clock readings. * coalesce_folded — how many siblings that call folded away, which is legitimately zero.

coalesce_outcome is the field which distinguishes "the fold ran and found nothing" from "the fold never ran". Those two look identical from outside, which is how #3878 stayed invisible for three months. tools/queue-wait-report.py reports the distribution and the outcome counts.

  • ended without executing (EVENT_TYPE_USAGE). Emitted on an op which a depends_on dependency ended before it ran, once the op's terminal state is written. Such an op never emits execution duration, so without this event it is indistinguishable in the log stream from one which has not run yet. Carries in extra:
    • outcome — abandoned (the dependency never went terminal and the dependency wait defer budget was spent), aborted (the dependency errored, aborted or was deleted) or cancelled (the dependency does not exist).
    • defer_count, wait_seconds and queue_name — as on execution duration, with wait_seconds measured from the op's enqueue to the ending, so for an abandoned op it is the whole of the budget's back-off ladder. The queue fields are present only when the dispatcher loaded the op from the table.
    • reason — the prose the op's state message carries.

tools/operation-timeline.py reads this stream and reports these ops in a table of their own, by outcome, instead of counting them as "ran after the window, or not yet". A runs_after wait which is given up on does not emit it: the op still runs.

  • coalesced sibling ops (EVENT_TYPE_STATUS). Emitted on a surviving op, and on the op's coalescing target, when one or more other pending ops on the same target with the same single coalescible task were folded into this one's execution. It lands on the target as well because an operation is hard deleted thirty seconds after it reaches a final state and takes its events with it (issue #3864), so an event recorded only against the survivor is unreadable within a minute of the fold; the network outlives it. For a net_op the target is the network, so this event is queryable through GET /networks/<uuid>/events. Carries three fields in extra:
    • sibling_count — how many siblings were folded.
    • sibling_uuids — their op uuids. Looking up any of those while the survivor runs shows it executing, with the message coalesced into <survivor uuid>. It moves to complete, with the same message, only once the survivor's tasks have all succeeded. If the survivor errored or deferred instead, the sibling stays executing until its own work item comes up and it runs itself, so its final state is always its own outcome. A sibling sitting in executing behind a failed survivor is therefore waiting its turn on the queue, not stuck. When its turn comes its state message still names the survivor, so the dispatcher records an audit event, "running an op which was already executing", to mark the start of its own run.
    • tasks — which coalescible task(s) drove the fold.

A burst of these on network_apply_update_dnsmasq is the expected outcome of multiple parallel instance starts on the same network and is healthy. A complete absence of these during a CI run that's known to be enqueueing duplicate work would point at a bug in either the enqueue-side dedup (mariadb.find_existing_coalescible_op) or the worker-side fold (mariadb.fold_coalescible_siblings).

Note that the worker-side fold also skips itself when the dispatcher just observed an empty queue (dispatcher_batch_size == 1). A new sibling arriving after our dequeue will be folded on the next dispatcher cycle, not this one, so a moderate gap between sibling-arriving and coalesced sibling ops firing is expected.

This paragraph described the diagnostic before anything used it. Between 2026-05-26 and 2026-08-24 the event never fired at all, on any cluster, because both primitives joined cluster_operations to object_states on columns that could never match (issue #3878). If you are reading historical event data from that window, its absence says nothing about the workload. There is now a functional test which asserts that one of the two coalescing events reaches a network after a burst of instance starts on it (shakenfist/deploy/shakenfist_ci/cluster_ci_tests/test_coalescing.py), so a repeat of that defect fails CI rather than waiting for an audit.

What to expect from these numbers. A 42 hour window on a moderately busy cluster (2026-08-27 to 2026-08-29) recorded a coalesce_seconds median of 3.7 ms, a p90 of 5.2 ms and a maximum of 149.5 ms, so a fold costing tens of milliseconds is normal and one costing hundreds is worth looking at. Over the same window the fold ran 1,335 times and folded a sibling on 7 of them. A long run of coalesce_folded: 0 is the expected state, not a fault — the fold only matches when duplicate work for one network is in flight at the same moment. What would indicate a fault is coalesce_outcome never once reading ran on a cluster doing network work, which is the shape #3878 had.

  • enqueue-side dedup: reused pending op (EVENT_TYPE_AUDIT). Emitted on the existing operation, and on the network, when a new enqueue was answered with an already-pending op instead of a new row. Carries requested_task and existing_op_uuid in extra. This is the enqueue-side counterpart of coalesced sibling ops; without it a deduped enqueue would leave no trace on the network's event stream at all, since the op it reuses was created by some earlier caller.

Neither primitive can filter on which queue a sibling is on -- cluster_operations has no queue column -- so what confines a fold to siblings the same dispatcher process actually drains is the coalescing key: a tuple of cluster_operations columns a sibling has to match every one of, not the single network_uuid column this used to be. For net_op the key is (network_uuid, node_uuid), and a column with no value binds IS NULL rather than being dropped, so a cluster-wide operation (node_uuid = None) folds only other cluster-wide operations while a per-node operation folds only its own node's. That is what makes network_ensure_mesh -- which updates only the enqueuing host's own FDB -- safe to coalesce despite being node-local work: two mesh ops for different nodes no longer look like the same key.

Naming node_uuid in the key is necessary but not sufficient. A per-node fold is only safe on a dispatcher that partitions its workers by target, which sf-net does (every operation for a network hashes to one worker thread) and sf-queues does not (spare slots are filled from a single unpartitioned dequeue call). Which dispatcher a per-node operation reaches depends on the queue family as well as the key -- network routes to sf-net, the default clusteroperation routes to sf-queues -- so both guards test the family too. That is enforced at enqueue time rather than left to convention: a coalescible task enqueued to a per-node target on a family sf-queues drains raises InvalidCoalescibleEnqueue. It is also why NodeNetOp.network_apply_create_hypervisor, whose model already carries both columns, is not coalescible: it is drained by sf-queues, where the per-worker-partitioning guarantee the argument rests on does not hold. See #3884.

Reading these events back

Neither event outlives its operation, so there is a window in which to read them and then they are gone.

A cluster operation is eligible for hard delete CLUSTER_OPERATION_RETENTION seconds after it reaches a final state (15 minutes by default) and is removed by the deleted-object sweep, and hard deleting an object removes the rows which join its events to it. Once that has happened there is nothing left to query: the operation is gone, and its events are orphaned rows which the daily prune sweep then deletes. Raise CLUSTER_OPERATION_RETENTION on a cluster whose operations are being investigated, or read the events from the log stream, which keeps them for as long as the log retention does. The MAX_USAGE_EVENT_AGE and MAX_STATUS_EVENT_AGE retention settings never come into it -- they bound how long an event may live, not how long the object it describes does. This is issue #3864.

What does persist is the log stream. Every event is echoed as a log line carrying the whole extra dict, unless LOG_EVENTS_TO_LOKI has been turned off, so wherever the cluster's logs are shipped is where an operation's history can still be read after the fact.

Do not grep that stream for Added event. That is the message the echo is written with, but the logger merges the caller's fields over the record last and one of those fields is the event's own message, so the string never reaches the shipped JSON. Filter on the event's message instead -- execution duration for the events above -- which is what the record's message field actually holds.

tools/queue-wait-report.py in the source repository summarises the execution duration events from such a stream: give it Shaken Fist JSON log lines on standard input -- from Loki, from journalctl -u 'sf-*.service' -o cat, or from a CI log bundle -- and it reports the queue-wait distribution by queue class, priority lane and operation type. It prints the two caveats needed to read those numbers: that a p90 at or below two seconds is the dispatcher's idle poll interval rather than queueing, and that wait_seconds includes deliberate deferral, which is why every percentile is also reported over just the operations which never deferred.

When that second caveat is the question rather than a footnote -- when a tail is deep and it matters whether the time went on deferral or on sitting in a queue -- tools/operation-timeline.py splits wait_seconds apart. It queries Loki itself rather than reading standard input, joining the Execution deferred events to the execution duration events on the operation uuid, and reports each operation's wait as three intervals: how long it sat before a dispatcher first picked it up, how much of the wait was deferral the dispatcher asked for, and how long it then sat after each redelivery. It also checks whether each rung of the back-off ladder was actually honoured, and reports whether any part of the window it read hit Loki's 5000 line query ceiling, since a truncated window otherwise looks exactly like a complete one. Operations which a dependency ended before they ran, which never emit execution duration, are read from the ended without executing events and reported as their own table by outcome, with how many times each deferred and how long it waited; an operation which spent the dependency wait defer budget is the six-minute tail the tool was written to explain, and used to be reported as having run after the window:

tools/operation-timeline.py --tenant sfcbr \
    --start 2026-08-29T00:00:00Z --end 2026-08-30T00:00:00Z

📝 Report an issue with this page