Repository navigation
Commit 81dfa7d
committed
extensions: add an OVN network extension
Guest networking for KVM on an OVN logical fabric, driven entirely by a script
through ovn-nbctl. It needs no changes to CloudStack and nothing on the
hypervisor beyond ovn-controller.
The KVM data path already works. OvsVifDriver handles BroadcastDomainType
Lswitch by emitting libvirt's <parameters interfaceid='<nic uuid>'/>, libvirt
turns that into external_ids:iface-id on the br-int port, and ovn-controller
binds it to the Logical_Switch_Port of that name -- the port-binding convention
OVN inherited from NVP. HypervisorGuruBase.toNicTO() copies the same NIC uuid
the extension is handed in prepare-nic, so the two names agree by construction.
Services, across 25 script commands:
Connectivity, Dhcp logical switch per network, native OVN DHCP
SourceNat, StaticNat NAT rows on a per-network logical router
PortForwarding Load_Balancer VIPs; OVN NAT has no L4 translation
Firewall ACL rows on the guest switch
VPC, NetworkACL one router per VPC, a leg and ACLs per tier
EVPN is optional and off by default. When enabled it sets the external_ids a
companion ovn-bgp-agent reads; the script does not touch FRR.
Private gateways, VPC static routes and private-gateway ACLs are implemented
but depend on a companion change to NetworkExtensionElement, which throws
UnsupportedOperationException for all four today. Stock CloudStack never
dispatches those commands, so the script is unaffected without it.
Also included:
test-with-ovn.sh integration test against a real OVN northbound database,
with --payloads and --concurrency modes. Not a unit test
and not run in CI: it needs an OVN to talk to.
ovn-host-setup.sh the host-side prerequisites that have no CloudStack API
behind them -- installing OVN, pointing ovn-controller at
the southbound database, a stable chassis name, the
provider bridge and its ovn-bridge-mappings entry, and
the agent's VIF driver. Three idempotent roles, with
--dry-run and --verify.
Verified against a real OVN 24.03 with ovn-northd and a live ovn-controller
chassis: 87 assertions over the full lifecycle with no northd errors; VIF
binding by external_ids:iface-id alone, with the NB ports going up; real
packets forwarded between VIFs and OVN answering DHCP itself; a second chassis
on a Geneve tunnel with BFD up both ways; 21 assertions replaying payloads
captured from NetworkExtensionElement; and 13 under concurrency.
Testing against a real database found four bugs, all fixed here and all kept as
regression tests:
* ACL and Logical_Router_Static_Route are not root tables, so a row created
in a transaction of its own is garbage collected before the follow-up
attach runs. That broke every firewall rule, every VPC network ACL and
every static route. Both sites now create and attach in one transaction
with --id. DHCP_Options and Load_Balancer are root tables, which is why the
same pattern was correct for them and the fault was invisible against a
stub.
* ovn-nbctl --may-exist is not atomic. Only Logical_Switch_Port and
Logical_Router_Port carry a name index, so eight parallel ls-add calls
produce three switches of one name. ensure_dhcp_options is reached from
both implement-network and prepare-nic, so a network coming up while
instances were deploying produced up to eight DHCP_Options rows with
instances split across them -- silently, since a later config-dhcp-subnet
updates only one and the rest keep serving stale settings. Fixed with a
per-command lock keyed on the network or VPC, a second lock for the
external switch shared across a public VLAN, and deterministic collapse of
duplicate rows for the case a file lock cannot reach.
* dhcpv4_options is a weak reference, so collapsing duplicates silently left
instances with no DHCP when their row was destroyed. Ports are re-pointed
before any row goes, and a sweep repairs any orphaned by a concurrent
collapse.
* ovs-vsctl add-port succeeds for a device that does not exist, leaving the
interface in an error state, so a typo in ovn-host-setup.sh --public-nic
looked like success and would have surfaced much later as no north-south
traffic. It now checks the interface error column and says how to undo it.
What remains unsafe is documented rather than papered over: two management
servers creating the same logical switch at the same instant can still produce
two of them, splitting the network. Preventing that needs a compare-and-swap,
which means OVSDB wait operations and a native client; the script logs it
loudly instead of leaving it to be discovered.
Added to the Debian package file list, which names extension scripts
explicitly. The RPM specs copy extensions/* wholesale and need no change.1 parent 6a0fcd6 commit 81dfa7d
5 files changed
Lines changed: 3599 additions & 0 deletions
File tree
- debian
- extensions/OVN
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments