all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [RFC PATCH v2 network/manager/docs 00/15] sdn: add OVN zone and controller plugins
@ 2026-11-27 10:28 Rémi PAETA
  2026-11-27 10:28 ` [RFC PATCH v2 network 01/15] sdn: controllers: add ovn plugin Rémi PAETA
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Rémi PAETA @ 2026-11-27 10:28 UTC (permalink / raw)
  To: pve-devel

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/<controller>/. 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/<vnet>/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(-)



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-11-27 10:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 10:28 [RFC PATCH v2 network/manager/docs 00/15] sdn: add OVN zone and controller plugins Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 01/15] sdn: controllers: add ovn plugin Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 02/15] sdn: zones: " Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 03/15] sdn: ovn: sync the northbound database on reload Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 04/15] sdn: ovn: configure the chassis on boot and on network reload Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 05/15] sdn: ovn: add port security Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 06/15] sdn: ovn: allow overriding the port security per vnet Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 07/15] sdn: subnets: refuse gateway, snat and dhcp on ovn zones Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 08/15] sdn: ovn: support ssl connections to the databases Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 network 09/15] sdn: ovn: bind guest ports to the chassis of their node Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 manager 10/15] ui: sdn: controller selector: allow filtering by controller type Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 manager 11/15] ui: sdn: add ovn controller Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 manager 12/15] ui: sdn: add ovn zone Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 manager 13/15] ui: sdn: vnet: add port security for ovn zones Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 manager 14/15] ui: sdn: vnet: disable isolate ports " Rémi PAETA
2026-11-27 10:28 ` [RFC PATCH v2 docs 15/15] sdn: document ovn zones and controllers Rémi PAETA

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal