From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id DC3901FF0B4 for ; Fri, 27 Nov 2026 11:44:01 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3A5CF217A7; Fri, 27 Nov 2026 11:43:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 smtp.infra.comaite.com A5C0962BE7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comaite.com; s=377A38C6-3A8D-11E5-A0EC-E97757B27CB3; t=1795775316; bh=9sZhri1BQU4r0ltioZ9eDsvcYJvZVcmxuDKp9u44EMA=; h=From:To:Date:Message-ID:MIME-Version; b=OsOBcpSH9kld9OOk5SZVMA9IUNujc2Rf95f/jXE+35y1o2tpvZ6DFe+AwlBS4MQX1 4PlxJHGtTtyT+85Of0yPo6lzPR14Gik+PDDb+FxEnQWWiEel3lYUh70669b3sLKljr 30x26ufe2qR4GajZbQxS7m0pE4S9yP4cROg02hNQ+FMioLiziInDdpwGAGnXJczych WBXMdtBhizLaBsu+6BtZBPaK2sUnhY3ovYAm58PulDMZcRndPJdGVYCeuerXU0fSuR U9C7AmSjUyENps4UOdWxEfFQgVD1aaSSEo6V3jODZo2FKGURb5g8terGGqMogZ9ear xZkq7SVEEPBXQ== From: =?UTF-8?q?R=C3=A9mi=20PAETA?= To: pve-devel@lists.proxmox.com Subject: [RFC PATCH v2 network/manager/docs 00/15] sdn: add OVN zone and controller plugins Date: Fri, 27 Nov 2026 11:28:21 +0100 Message-ID: <20261127102836.313797-1-remi.paeta@comaite.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL -2.143 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_DBL_SPAM 5 Contains a spam URL listed in the Spamhaus DBL blocklist [sdn.pm] Message-ID-Hash: PXGHCU3H3J6SRDTCZFJCCUQ7ZUG4XFOX X-Message-ID-Hash: PXGHCU3H3J6SRDTCZFJCCUQ7ZUG4XFOX X-MailFrom: remi.paeta@comaite.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This series adds OVN (Open Virtual Network) support to the SDN stack, as first discussed in: https://lore.proxmox.com/pve-devel/1116090294.1714263.1791537779868.JavaMail.zimbra@comaite.com/ v1: https://lore.proxmox.com/pve-devel/20261013121432.2642979-1-remi.paeta@comaite.com/ It covers the first step outlined there: an OVN controller, OVN zones and vnets, providing a distributed L2 overlay with optional per-port anti-spoofing. Routing (subnet gateways, SNAT), native DHCP and OVN ACLs are left for later steps. Sent as RFC, as some design choices below would benefit from your feedback before going further. Overview ======== - The OVN central components (northbound/southbound databases, ovn-northd) are deployed by the administrator, ideally as a RAFT cluster, on the PVE nodes or elsewhere. An "ovn" SDN controller holds their connection strings, plain TCP or SSL. - Each vnet of an "ovn" zone is an OVN logical switch. On reload, the northbound database is synced once for the whole cluster: switches get created, updated and deleted, ports of removed guests and guest interfaces get cleaned up. Only objects tagged with pve-sdn-* external_ids are touched, so the deployment can be shared. - On every node of an OVN zone, ovn-controller gets configured (remote, encapsulation, tunnel IP from the route towards the southbound database). pvenetcommit.service removes the Open vSwitch database on every boot, so a oneshot pve-sdn-ovn-chassis.service sets it again before the guests start. - Guest interfaces are plugged into br-int and bound to a logical switch port named after them. Each vnet still gets an empty OVS bridge, which lets qemu-server and pve-container read its MTU and set up the firewall bridge like for any OVS bridge, so the guest firewall works unchanged. pve-manager needs no backend change. - Port security, per zone with a per-vnet override: off (default), mac, or mac-ip with the IPAM addresses (IPv4 and IPv6). The guest MAC is set from add_bridge_fdb. A changed level applies on reload, without restarting guests. - With SSL, the administrator provides the CA and one certificate per node in /etc/pve/priv/sdn/ovn//. ovn-controller only takes certificates on its command line, so a runtime drop-in for its unit adds them; it is only restarted when that setup changes. - Guest ports are bound to the chassis of their node (requested-chassis option). On live migration, they are bound to both nodes with activation-strategy=rarp, the source staying the main chassis, and to the destination only when qemu-server calls add_bridge_fdb right before resuming the guest. Changes since v1 ================ Mostly fixes of failure paths, found while reviewing them: - sync: the guest list is read after the ports, and the sync fails instead of deleting all guest ports when pmxcfs cannot provide it; ports are deleted by UUID, so that a port re-created by a guest start in the meantime is left alone; --if-exists/--may-exist, so that an object deleted or created in the meantime does not fail the whole transaction - security review: values read from the shared northbound database (port names, recorded MACs) are validated before use in commands and IPAM queries; the copied SSL key is also removed after a reboot when SSL is not used anymore; connection strings no longer accept a trailing newline - sync: ports without a MAC yet (NICs hotplugged without add_bridge_fdb, see below) get it from the guest configuration - chassis: ovs-vsctl uses --timeout and --no-wait, as a stopped ovs-vswitchd blocked the boot service, and with it all guest starts; the unit gets a start timeout and is also ordered before pve-ha-lrm - live migration: QEMU keeps PVE_MIGRATED_FROM in its environment and passes it to the script plugging later hotplugged NICs, which were bound to two chassis and never activated; it is now only taken into account while the guest configuration is still on the source node - tap_plug takes the controller from the running zone configuration, like the vnet, and not from the pending one (get_plugin_config() reads the pending zones.cfg, for all zone types) - ui: the port security fields get a clear trigger, as the default could not be selected again once a level was set - dropped the proxmox-ve-rs patch: proxmox-ve-config now represents unknown zone types (e109f98), which covers OVN zones, so libpve-rs-perl and proxmox-firewall need no OVN-specific change anymore - rebased on current master - each patch lists its own changes since v1 Dependencies ============ - libpve-rs-perl and proxmox-firewall need to be built with proxmox-ve-config 0.12.0 (e109f98, "ve-config: sdn: tolerate unknown types and mismatched gateways"), otherwise the SDN IPSets are missing as soon as an OVN zone exists. Should pve-network get Breaks on older versions? - pve-manager depends on a libpve-network-perl knowing the vnet 'port-security' option. - Hotplugged NICs of VMs, and NICs re-plugged into another vnet, only get their MAC and port security on the next SDN reload, VM start or migration, as qemu-server does not call add_bridge_fdb on hotplug. Until then, the port security of such a NIC is not enforced. This is bug #6490 for bridges with MAC learning disabled, whose fix is now applied in qemu-server (27e51213); pve-network would need a versioned Depends or Breaks on the next qemu-server release to rely on it. Known limitations ================= - No routing, SNAT or DHCP yet: subnet gateways, SNAT and DHCP ranges are refused on OVN zones, as are VLAN tags, VLAN-aware vnets and isolated ports. - With mac-ip, IPv6 link-local traffic is only allowed from the address derived from the MAC, which breaks guests using stable privacy link-local addresses for link-local protocols. - If the IPAM cannot be queried, a reload keeps the current port addresses, while a starting guest only gets its MAC enforced. - If the northbound database cannot be reached, running guests keep their connectivity, but guests on OVN zones cannot be started, and a NIC re-plugged because of a firewall, tag or bridge change stays unplugged until the change is applied again (see the open questions). - Ports of removed guests or NICs are only removed on the next SDN reload, and OVN keeps answering ARP for their IPs until then. - The tunnel IP comes from the route towards the southbound database; if that route is only learned dynamically (SDN fabric), it may not exist yet when the boot service runs. - The default MTU of 1442 assumes an IPv4 underlay (20 bytes less with IPv6). With phpIPAM, mac-ip only enforces the MAC, as the plugin cannot look up IPs by MAC. - Port security does not make guests unable to use the MAC of another guest of the vnet (MACs are not checked for uniqueness), a vnet admin can override the zone level, and mac-ip only restricts IPs known to the IPAM. See the security considerations of the docs. - Guest starts still block if ovs-vswitchd does not run, as pve-common adds the port to the integration bridge without a timeout. Testing ======= Unit tests cover the new code (102 new tests in pve-network, each patch tested separately), as do tests against real ovsdb-server instances. On a three node cluster with the OVN databases clustered on the nodes, over SSL, with this version: - VM and container connectivity across nodes, NIC hotplug and re-plug (firewall toggling), live migration (0.4 to 1.1 s of loss, the same range as with a Linux bridge and the same probe, QEMU downtime ~20 ms), NIC hotplug after a migration, container migration, removal of NICs and orphaned ports, SDN reload with running guests; with and without the fix for bug #6490 in qemu-server - port security with IPv4 and IPv6 from the PVE IPAM: IPs on the ports, spoofed MAC and IPs blocked, IPAM changes applied on reload - northbound/southbound leader failover, and full outage of all database members (no loss for running guests, guest start refused, recovery) - re-plugging a NIC with the northbound database unreachable (see the open questions) - iptables firewall: SDN IPSets of OVN zones (with the proxmox-ve-rs patch of v1; with proxmox-ve-config 0.12.0, only checked by a unit test so far) Tested with the previous version only, as the code involved did not change: nftables firewall, ipfilter and macfilter, node crash and HA recovery, Geneve to VXLAN encapsulation switch and back, zones restricted to nodes, removal of zones and of the controller. Design notes ============ - The OVN central components are deployed and operated separately, by the administrator. Deploying and managing them directly on the Proxmox VE cluster (for example as a RAFT cluster on some of the nodes, set up from the API) could be a later evolution. - The guest start is refused while the northbound database cannot be reached. Starting the guest without its port would not help: the southbound database usually runs on the same hosts and is down too, so no chassis can claim a port, and a guest started elsewhere by HA could not be claimed anyway, as requested-chassis still names the previous node and only the northbound database can change it. - With mac-ip and an unreachable IPAM, a starting guest only gets its MAC enforced (fail-open). The IPs are looked up through Ipams::get_ips_from_mac, so the MAC cache answers for known guests, and this only happens for a MAC the IPAM never returned before. Zones with DHCP fail the guest start in that case instead (through add_dhcp_mapping); I kept fail-open here so that an IPAM outage does not prevent starting guests, but can change it if you prefer. - Certificates are left to the PKI of the OVN deployment (renewal, expiry). An API/GUI import could come later, ideally with the key generated on each node and only the signed certificate imported. Open questions ============== 1. Each vnet currently gets an empty OVS bridge, while the guest interfaces are plugged into br-int. It only exists because qemu-server reads the vnet MTU from /sys/class/net//mtu (read_bridge_mtu, which also checks the bridges on migration targets), and to keep the firewall bridge setup of OVS bridges. This needs no change outside pve-network. Is this acceptable, or would you prefer one of these alternatives? a) An SDN dispatcher, for example PVE::Network::SDN::Zones::get_bridge_mtu(), returning the zone MTU for OVN vnets and reading sysfs otherwise, called by qemu-server and pve-container instead of read_bridge_mtu(). No placeholder interface anymore, but it touches both repositories (pve-common cannot depend on pve-network), and every place assuming that a vnet is a local interface would need the same treatment. b) A lighter placeholder: a dummy interface named after the vnet instead of an OVS bridge. Still no change outside pve-network, and nothing in the Open vSwitch database, but the firewall bridge setup would need to be checked again. 2. Is extending the common vnet schema with 'port-security' fine? As vnets have a single section type, I saw no other place for a per-vnet option. 3. VLAN-aware vnets are out of scope for this series. Guest-tagged trunks could later use the vlan-passthru option of logical switches, while per-NIC VLAN tags would need one logical switch per VLAN. Is either of interest? 4. Not specific to OVN, but noticed while testing it: deleting a vnet without subnets is not refused while guests still use it, on any zone type. Running guests end up unplugged and fail on their next start. Would you take a separate patch refusing the deletion with the list of guests using the vnet? 5. Re-plugging a NIC (firewall, tag or bridge change) needs the northbound database: qemu-server and pve-container unplug the interface before calling the SDN tap_plug, so if ensure_port fails (database unreachable), the NIC stays unplugged. Binding the interface before ensure_port would keep it connected, but could let ovn-controller claim a stale port of another vnet (NIC moved off OVN and back before a reload). We kept the safe order. Would you rather pass the old network to tap_plug (or skip the unplug when the bridge does not change), or keep a local record of the plugged vnet, so that a re-plug into the same vnet does not depend on the database? 6. Ports are only removed on SDN reload, as there is no SDN hook when a NIC or a guest gets removed. Would such a hook be welcome, or should the sync rather run more often? 7. The sync runs on the node handling the reload API call, with its ovn-nbctl and SSL certificate, and a northbound database is assumed to be used by one cluster only (objects are tagged with the controller ID, not with a cluster ID). Is that acceptable, or should the sync run on a node of the OVN zones, and the objects carry the cluster name? network: debian/control | 1 + debian/libpve-network-perl.install | 1 + debian/libpve-network-perl.postinst | 2 + src/PVE/API2/Network/SDN.pm | 8 + src/PVE/API2/Network/SDN/Vnets.pm | 8 + src/PVE/Network/SDN.pm | 39 +- src/PVE/Network/SDN/Controllers.pm | 6 + src/PVE/Network/SDN/Controllers/Makefile | 2 +- src/PVE/Network/SDN/Controllers/OvnPlugin.pm | 90 ++ src/PVE/Network/SDN/Makefile | 3 +- src/PVE/Network/SDN/Ovn.pm | 1133 +++++++++++++++++ src/PVE/Network/SDN/SubnetPlugin.pm | 9 + src/PVE/Network/SDN/VnetPlugin.pm | 8 + src/PVE/Network/SDN/Zones.pm | 2 + src/PVE/Network/SDN/Zones/Makefile | 2 +- src/PVE/Network/SDN/Zones/OvnPlugin.pm | 190 +++ src/services/Makefile | 1 + src/services/pve-sdn-ovn-chassis.service | 18 + src/test/Makefile | 5 +- src/test/run_test_ovn.pl | 972 ++++++++++++++ src/test/run_test_vnets_blackbox.pl | 21 + .../ovn/basic/expected_controller_config | 8 + .../zones/ovn/basic/expected_sdn_interfaces | 12 + src/test/zones/ovn/basic/interfaces | 5 + src/test/zones/ovn/basic/sdn_config | 24 + .../ovn/with_evpn/expected_controller_config | 44 + .../ovn/with_evpn/expected_sdn_interfaces | 48 + src/test/zones/ovn/with_evpn/interfaces | 7 + src/test/zones/ovn/with_evpn/sdn_config | 35 + 29 files changed, 2699 insertions(+), 5 deletions(-) manager: www/manager6/Makefile | 2 + www/manager6/Utils.js | 10 +++++ www/manager6/form/SDNControllerSelector.js | 9 +++- www/manager6/sdn/VnetEdit.js | 50 +++++++++++++++++++++- www/manager6/sdn/controllers/OvnEdit.js | 50 ++++++++++++++++++++++ www/manager6/sdn/zones/OvnEdit.js | 47 ++++++++++++++++++++ 6 files changed, 165 insertions(+), 3 deletions(-) docs: pvesdn.adoc | 329 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 327 insertions(+), 2 deletions(-) Summary over all repositories: 36 files changed, 3191 insertions(+), 10 deletions(-)