Repository navigation
Commit 111ac20
fix(neutron): give real mode a network node and a firewall per port
Round 2 of SPEC-033's real-mode layout, as upstream's: one network node
(neutron.network_node; without VXLAN every node is its own) holds every
router in a qrouter-<id> namespace and each network's DHCP and metadata in
a qdhcp-<network> namespace. Every port is firewalled on the node it is
bound to (binding:host_id) by its own iptables chains, built from its
groups with remote groups resolved to their members, in iptables and ebpf
mode alike. The per-fixed-IP floating-IP filter is retired.
- A request stores its change, has the node that holds the state apply
it before the answer (a function call there, an authenticated one-second
node call otherwise), and undoes its own change compare-and-set when
that fails. A deletion removes the host state before its record and
re-applies it when the record stays.
- The DHCP port takes the lowest free pool address; dnsmasq serves static
ranges with option 121; metadata is served in the namespace and
identifies a guest by network and address. Ports honour fixed_ips.
- Nova binds a port before the guest starts, a revived guest's too, and
every domain names the guest's TAP for its port.
- Each node's reconciler converges what it holds both ways, removing by
"no record" only after a complete read; it removes what earlier layouts
left where it recognises it, the uplink's stray proxy entries, and the
VXLAN entries and devices no record holds. Teardown and its
database-less fallback remove the new layout.
- At start, real mode loads br_netfilter and turns on bridge-nf-call-
iptables and -ip6tables; readiness fails, naming bridge-netfilter,
while they do not hold.
- The chart's pod and the KVM Compose file mount the host's /run/netns
both ways and /lib/modules read-only; the teardown purge Job mounts
/run/netns. The chart runs real mode privileged, as bidirectional
propagation needs, and refuses multi-node VXLAN without
neutron.networkNode.
- Removed: TAPDeviceManager and the metadata DNAT remover, which nothing
called any more, github.com/coreos/go-iptables, which nothing imports,
and pkg/networking's eBPF wrapper, which lost its last caller with
Neutron's TAP; pkg/networking/ebpf stays for the separate decision.
- Docs: UPGRADING.md (round 2's answers, the clean break), EBPF_STATUS.md,
the networking, VXLAN, configuration, troubleshooting, scaling and
architecture docs, the chart README, CLAUDE.md; the host runbook; the
Horizon compatibility report, recording instance Edit Security Groups
as verified.
- A security group rule is checked and stored as upstream's: its
direction, ethertype, protocol, ports and remote prefix, each refusal
a 400 under upstream's name. The port firewall writes a rule only as
it parses it and leaves out what it cannot express: a newline in a
rule's remote or protocol reached iptables-restore's input, which runs
as root.
- A subnet's DNS servers are checked as upstream's on create, and the
DHCP configuration writes a gateway or DNS server only as an IPv4
address: a newline in one reached dnsmasq's configuration, which
starts as root.
- The branch review's findings (tasks T169-T239): router ports are the
router's records, so the port API refuses them (ServicePortInUse) and
no member's port is routed; a port forwarding finds its router from
its internal port, as upstream's, and frees it with the last one;
every undo takes the allocation lock and leaves an address someone
took meanwhile; a revived guest's TAP is named and filtered; deletions
re-check under their locks; a subnet's gateway change reaches its
routers. Answers follow upstream: in-use refusals carry upstream's
messages, If-Match is read as upstream reads it, a port's and a
subnet's create and update answer as their show, listings and creates
ensure the project's default group. The port firewall writes a MAC as
iptables-save prints it, so an unchanged node is only read, which
tests now check against captured iptables-save output. The node call
is served before the users' auth, with plain absent and absent_ids;
unit locks go with their last user; migration 085 keeps an index on
security_groups (project_id, name), and its marker is
"-- lightstack:foreign-keys-off", read on the file's first line only.
- The second branch review's findings (tasks T242-T310): a subnet's
ip_version must match its CIDR, and DHCP serves IPv4 subnets only, so
no record stops the reconciler; a deleted port's still-running TAP is
dropped both ways before any port's chains (ls-bound-in and -out);
protocols are written as iptables prints them, so vrrp no longer fails
a node's commit; a rule's delete locks its group first; a server's
deletion frees its forwardings' floating IPs, and a losing deletion
binds nothing back; requests waiting on a unit share one converge; one
request gives each address once, and a gateway keeps the address it is
not asked to change; a port forwarding's update is checked as its
create; router:external stays while a gateway uses it; trunks take
only ports the caller can see; add_router_interface takes a port.
Answers follow upstream for trusted ports, an empty remote group, the
rule listing's filters, fixed_ip_address without a port and zoned
pools.
The node call bypasses HTTP proxies, network_node is read trimmed, the
chart refuses multi-node without VXLAN, and the turnkey Compose mounts
the host's /run/netns.
- A subnet's enable_dhcp, turned on or off, moves the network's DHCP
port onto or off the subnet, and the network node applies it before
the answer; when it cannot, the update is undone, compare-and-set.
- A network's connection-tracking zone is read and taken under one
transaction-scoped lock, and the statement runs once: it no longer
retries a zone another request took (constitution Article III).
database.AdvisoryLock takes that lock, and the quota and floating-IP
locks, which each wrote the statement out.
- An update's undo puts a floating IP's old association back only where
the rules still allow it, under an association's locks, as a
deletion's restore does; otherwise the floating IP comes back
unassociated. Migration 084 refuses a second floating IP of a network
on one fixed IP of a port, as upstream's unique constraint does.
- An orphan TAP's frames addressed to this host are dropped too, not
only those the bridge forwards.
- A router interface port with several fixed IPs, which add by port
accepts as upstream's, has every one on its leg and joins the router
to each subnet: the duplicate check, a removal and an undo see them
all, and a removal by one subnet takes only it off the port. One
IPv6 port of a network per router, and an IPv6 subnet added by subnet
joins that port, as upstream's.
- A gateway on a new port takes the default route onto its new leg
before the old leg goes, also when the next hop stays the same.
- Every query for a router's gateway port asks for the one the router
code writes, without a project: an undone gateway change no longer
restores a member's port naming the router as its gateway, a router's
deletion leaves such a port, and the reconciler does not take its
address for Lightstack's.
Run on one Kubernetes node (k3s, real libvirt, Horizon) on 2026-11-23
with the host runbook: every step passed. Two nodes are not supported
yet, so their host run is dropped from the spec and the tasks. Known gap,
outside this change: VXLAN devices have no flooding destination, so
broadcast does not cross nodes and a guest off the network node gets no
DHCP lease (follow-ups.md, 5.1).
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Uwe Schwaeke <uwe.schwaeke@sap.com>1 parent 8672d46 commit 111ac20
305 files changed
Lines changed: 31643 additions & 11228 deletions
File tree
- .specify/memory
- charts/lightstack
- ci
- templates
- tests
- cmd/lightstack
- config
- deployments
- docs
- compatibility
- specs/033-sg-port-membership
- checklists
- contracts
- internal
- cinder
- common
- database
- dbtest
- health
- keystone
- metadata
- middleware
- neutron
- nova
- teardown
- migrations
- pkg
- hypervisor
- networking
- testdata/iptables-save
- scripts
- test
- contract
- neutron
- nova
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
355 | 358 | | |
356 | 359 | | |
357 | 360 | | |
358 | | - | |
| 361 | + | |
| 362 | + | |
359 | 363 | | |
360 | 364 | | |
361 | 365 | | |
| |||
426 | 430 | | |
427 | 431 | | |
428 | 432 | | |
429 | | - | |
| 433 | + | |
430 | 434 | | |
431 | 435 | | |
432 | 436 | | |
| |||
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
482 | 494 | | |
483 | 495 | | |
484 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
225 | | - | |
226 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
227 | 231 | | |
228 | 232 | | |
229 | 233 | | |
| |||
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
238 | | - | |
| 242 | + | |
239 | 243 | | |
240 | 244 | | |
241 | 245 | | |
| |||
267 | 271 | | |
268 | 272 | | |
269 | 273 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
273 | 283 | | |
274 | 284 | | |
275 | 285 | | |
| |||
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
281 | | - | |
| 291 | + | |
282 | 292 | | |
283 | 293 | | |
284 | 294 | | |
| |||
501 | 511 | | |
502 | 512 | | |
503 | 513 | | |
504 | | - | |
| 514 | + | |
505 | 515 | | |
506 | 516 | | |
507 | 517 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
0 commit comments