all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members
@ 2026-11-18 11:57 David Riley
  2026-11-18 11:57 ` [PATCH pve-access-control v4 1/6] rpcenv: add SDN.Allocate to modify permission check David Riley
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Maintainer Note:

This patch requires version bumps:
* pve-access-control
* pve-manager
* pve-network

Please also ensure that the correct version is set in the pve-manager
api patch where 'assert_min_cluster_version' (Pool.pm) is called.

This series does not depend on '[PATCH access-control/network v6 0/8]
fix #7520: sdn: prune orphaned ACLs and handle VNet migrations' [1]
anymore as this has been applied recently.

---

Differences from v3:
- New: Patch 1: rpcenv: add SDN.Allocate to modify permission check
- Fix: Properly enforce `SDN.Allocate` permissions when modifying
  pools (Patch 5/6)
- Fix: Relocated the VLAN-awareness check. Previously, if a VNet had
  its VLAN-awareness disabled while it was a member of a pool, users
  were prevented from removing it from that pool.
  (Patch 5/6)
- Fix: Change default Vlan Tag dropdown text from 'All' to 'untagged'
  to reflect the actual behavior.

Differences from v2:
- Add/Improve: Instead of allowing full vnet access (tagged and
  untagged using the base path 'sdn/zones/<zone>/<vnet>' there is now
  an explicit path for this 'sdn/zones/<zone>/<vnet>/*' this allows
  access to untagged and tagged traffic of this specific vnet. In the
  WebUI this is reflected by a 'propagate' flag.
  Using just 'sdn/zones/<zone>/<vnet>' only allows for untagged use of
  this vnet, so trying to add a NIC with tag 1 will fail.
  Thanks @Daniel K. for the great suggestion!
- Refactor: migrate vnet zone in pool. Passing in a array of path
  strings instead of each single path. This avoids locking the
  user.cfg for each path. Passing in strings because the underlying
  patch series was adapted. [1]
- Refactor: remove vnet from pool. Similar to migrations this now
  also gets passed an array of path strings and only locks the
  configuration once.
- Reorder: patches to improve the review flow
- Remove: #7294 from unrelated commits
- Fix: various nits
- Add: maintainer note about bumping the version to ensure the
  gatekeeper for this feature works properly


Differences from v1:
- Access: Fix permissions propagation.
  Pool ACL paths are setup without propagation, therefore checking
  /sdn/zones/<zone>/<vnet>/<tag> fails even if the user has the
  permission for the base path /sdn/zones/<zone>/<vnet>.
  To allow this, the roles of the base VNet path are looked up if
  the exact tagged path is not found in the pool (see patch 5/9).
- API: Add a unified property string format for VNets 
  (zone=<zone>,vnet=<vnet>,tag=<tag>]), ensuring that zone and vnet
  are strictly required and coupled.
- API CLI: Add typetext to the vnet format for better error messages
  in the CLI
- API: The registered format validation for VNets and Zones now also
  check the length.
- API: Add membership checks for network resources during add/delete
  operations (matching storage/VM behavior).
- Relocated version helpers from PVE::Cluster to PVE::Tools
- UI: Fix light mode. The icons are now light grey to match the
  storage and vm icons.
- Series is now based on v4 instead of v3 of [1]
- Minor refactors

=== Original Cover Letter ===

This series implements support for adding SDN VNets to resource pools,
resolving #7294 [0]. This series depends on the v4 'fix #7520: sdn:
prune orphaned ACLs and handle VNet migrations' [1].

It does not, however, add zones as pool members as requested in #7294.
Zones currently share ACL paths for managing the zone itself and
allocating VNets within it. This makes self-service VNet management
without also granting zone management (and its associated 
side-effects) difficult.

This patch series extends the pool section in the user.cfg and
introduces a new network property to the pool configuration which will
hold VNet entries:
* vnet/<zone>/<vnet>
* vnet/<zone>/<vnet>/<vlan>

The type prefix allows future extension to other network resource 
types.

To prevent potential data loss from overwriting newly added VNets, a
cluster-version check is added which ensures all nodes are running a
version that supports this feature. Note: The hardcoded version guard
should be updated to match the final target release when being
applied.

The existing version check helpers were moved from `qemu-server` to a
new module within `pve-cluster` to make them available for this
implementation, and any future developments that require gatekeeping.
Appropriate attribution has been included for the relocated code.
Please let me know if this organizational move aligns with current
design preferences or additional adjustments are needed.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=7294
[1] https://lore.proxmox.com/pve-devel/20260716104247.29047-1-d.riley@proxmox.com/


pve-access-control:

David Riley (1):
  rpcenv: add SDN.Allocate to modify permission check

 src/PVE/RPCEnvironment.pm | 2 ++
 1 file changed, 2 insertions(+)


pve-network:

David Riley (2):
  sdn: register api formats for zones and vnets
  fix #7294: sdn: vnet: update pool members on vnet migration and
    deletion

 src/PVE/Network/SDN.pm              |  6 ++++++
 src/PVE/Network/SDN/VnetPlugin.pm   | 26 +++++++++++++++++++++++---
 src/PVE/Network/SDN/Zones/Plugin.pm | 26 +++++++++++++++++++++++---
 3 files changed, 52 insertions(+), 6 deletions(-)


pve-manager:

David Riley (3):
  ui: replace var with let to match style guide for variable declaration
  fix #7294: api: pool: add SDN VNets as pool members
  fix #7294: ui: pool: add SDN VNets as pool members

 PVE/API2/Pool.pm                 | 151 ++++++++++++++++++++++++++-
 www/css/ext6-pve.css             |  15 +++
 www/manager6/Utils.js            |   1 +
 www/manager6/grid/PoolMembers.js | 173 ++++++++++++++++++++++++++++---
 4 files changed, 321 insertions(+), 19 deletions(-)


Summary over all repositories:
  8 files changed, 375 insertions(+), 25 deletions(-)

-- 
Generated by murpp 0.11.0




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

* [PATCH pve-access-control v4 1/6] rpcenv: add SDN.Allocate to modify permission check
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-18 11:57 ` [PATCH pve-network v4 2/6] sdn: register api formats for zones and vnets David Riley
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Map the entire SDN namespace ('/sdn/*') to the 'SDN.Allocate'
privilege when verifying resource modification rights.

Previously, the access control helper lacked a dedicated mapping for
SDN resources. This caused checks to fall back to strictly requiring
global admin rights ('Permissions.Modify'), which prevented downstream
API endpoints from properly verifying allocation rights for standard
users trying to manage SDN resources.

Fixes: edc2154 ("fix #7294: acl: pool: add SDN VNets as pool members")
Signed-off-by: David Riley <d.riley@proxmox.com>
---
 src/PVE/RPCEnvironment.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/RPCEnvironment.pm b/src/PVE/RPCEnvironment.pm
index 0104b1e..09854d5 100644
--- a/src/PVE/RPCEnvironment.pm
+++ b/src/PVE/RPCEnvironment.pm
@@ -524,6 +524,8 @@ sub check_perm_modify {
         push @$testperms, 'Datastore.Allocate';
     } elsif ($path =~ m|^/vms/.+$|) {
         push @$testperms, 'VM.Allocate';
+    } elsif ($path =~ m|^/sdn/.+$|) {
+        push @$testperms, 'SDN.Allocate';
     } elsif ($path =~ m|^/pool/.+$|) {
         push @$testperms, 'Pool.Allocate';
     }
-- 
2.47.3





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

* [PATCH pve-network v4 2/6] sdn: register api formats for zones and vnets
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
  2026-11-18 11:57 ` [PATCH pve-access-control v4 1/6] rpcenv: add SDN.Allocate to modify permission check David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-18 11:57 ` [PATCH pve-network v4 3/6] fix #7294: sdn: vnet: update pool members on vnet migration and deletion David Riley
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Register JSONSchema format validators for both SDN zones and VNets,
enabling the pool members API to verify these network identifiers.

Prepare for #7294 to enable schema validation of pool resources.

Signed-off-by: David Riley <d.riley@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294
---
 src/PVE/Network/SDN/VnetPlugin.pm   | 26 +++++++++++++++++++++++---
 src/PVE/Network/SDN/Zones/Plugin.pm | 26 +++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/src/PVE/Network/SDN/VnetPlugin.pm b/src/PVE/Network/SDN/VnetPlugin.pm
index 7a38457..b855827 100644
--- a/src/PVE/Network/SDN/VnetPlugin.pm
+++ b/src/PVE/Network/SDN/VnetPlugin.pm
@@ -16,14 +16,34 @@ PVE::Cluster::cfs_register_file(
     sub { __PACKAGE__->write_config(@_); },
 );
 
+my $sdn_vnet_id_pattern = '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]';
+my $vnet_min_length = 2;
+my $vnet_max_length = 8;
+
+sub pve_verify_sdn_vnet_id {
+    my ($vnet, $noerr) = @_;
+
+    my $len = length($vnet);
+
+    if ($vnet !~ m/^$sdn_vnet_id_pattern$/o || $len < $vnet_min_length || $len > $vnet_max_length) {
+        return undef if $noerr;
+        die "invalid SDN VNet '$vnet', must be $vnet_min_length-$vnet_max_length characters"
+            . " long, start with a letter, and contain only alphanumeric characters\n";
+    }
+    return $vnet;
+}
+
+PVE::JSONSchema::register_format('pve-sdn-vnet-id', \&pve_verify_sdn_vnet_id);
+
 PVE::JSONSchema::register_standard_option(
     'pve-sdn-vnet-id',
     {
         description => "The SDN vnet object identifier.",
         type => 'string',
-        pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
-        minLength => 2,
-        maxLength => 8,
+        format => 'pve-sdn-vnet-id',
+        pattern => $sdn_vnet_id_pattern,
+        minLength => $vnet_min_length,
+        maxLength => $vnet_max_length,
     },
 );
 
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index f3844ff..c463d57 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -18,14 +18,34 @@ PVE::Cluster::cfs_register_file(
     sub { __PACKAGE__->write_config(@_); },
 );
 
+my $sdn_zone_id_pattern = '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]';
+my $zone_min_length = 2;
+my $zone_max_length = 8;
+
+sub pve_verify_sdn_zone_id {
+    my ($zone, $noerr) = @_;
+
+    my $len = length($zone);
+
+    if ($zone !~ m/^$sdn_zone_id_pattern$/o || $len < $zone_min_length || $len > $zone_max_length) {
+        return undef if $noerr;
+        die "invalid SDN zone '$zone', must be $zone_min_length-$zone_max_length characters long,"
+            . " start with a letter, and contain only alphanumeric characters\n";
+    }
+    return $zone;
+}
+
+PVE::JSONSchema::register_format('pve-sdn-zone-id', \&pve_verify_sdn_zone_id);
+
 PVE::JSONSchema::register_standard_option(
     'pve-sdn-zone-id',
     {
         description => "The SDN zone object identifier.",
         type => 'string',
-        pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
-        minLength => 2,
-        maxLength => 8,
+        format => 'pve-sdn-zone-id',
+        pattern => $sdn_zone_id_pattern,
+        minLength => $zone_min_length,
+        maxLength => $zone_max_length,
     },
 );
 
-- 
2.47.3





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

* [PATCH pve-network v4 3/6] fix #7294: sdn: vnet: update pool members on vnet migration and deletion
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
  2026-11-18 11:57 ` [PATCH pve-access-control v4 1/6] rpcenv: add SDN.Allocate to modify permission check David Riley
  2026-11-18 11:57 ` [PATCH pve-network v4 2/6] sdn: register api formats for zones and vnets David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-18 11:57 ` [PATCH pve-manager v4 4/6] ui: replace var with let to match style guide for variable declaration David Riley
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Update or remove corresponding resource pool allocations in user.cfg
whenever a VNet is altered or deleted. This prevents stale paths and
dangling references from breaking the configuration integrity.

Signed-off-by: David Riley <d.riley@proxmox.com>

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294
---
 src/PVE/Network/SDN.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 9373ec3..7a4a9e3 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -256,12 +256,18 @@ sub cleanup_access_control {
 
     if (@$vnet_move_paths) {
         PVE::AccessControl::migrate_sdn_resource_access($vnet_move_paths);
+        PVE::AccessControl::migrate_vnet_zone_in_pool($vnet_move_paths);
     }
 
     my @paths_to_delete = (@$vnet_delete_paths, @$route_map_paths, @$generic_paths);
+
     if (@paths_to_delete) {
         PVE::AccessControl::remove_sdn_resource_access(\@paths_to_delete);
     }
+
+    if (@$vnet_delete_paths) {
+        PVE::AccessControl::remove_vnets_from_pool($vnet_delete_paths);
+    }
 }
 
 sub diff_generic_resources {
-- 
2.47.3





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

* [PATCH pve-manager v4 4/6] ui: replace var with let to match style guide for variable declaration
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (2 preceding siblings ...)
  2026-11-18 11:57 ` [PATCH pve-network v4 3/6] fix #7294: sdn: vnet: update pool members on vnet migration and deletion David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-18 11:57 ` [PATCH pve-manager v4 5/6] fix #7294: api: pool: add SDN VNets as pool members David Riley
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

No semantic change intended.

Signed-off-by: David Riley <d.riley@proxmox.com>
Reviewed-by: Daniel Kral <d.kral@proxmox.com>

Link: https://pve.proxmox.com/wiki/Javascript_Style_Guide#Variables
---
 www/manager6/grid/PoolMembers.js | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/www/manager6/grid/PoolMembers.js b/www/manager6/grid/PoolMembers.js
index b0c9ccb3..69f50e30 100644
--- a/www/manager6/grid/PoolMembers.js
+++ b/www/manager6/grid/PoolMembers.js
@@ -13,7 +13,7 @@ Ext.define('PVE.pool.AddVM', {
     },
 
     initComponent: function () {
-        var me = this;
+        let me = this;
 
         if (!me.pool) {
             throw 'no pool specified';
@@ -23,7 +23,7 @@ Ext.define('PVE.pool.AddVM', {
         me.method = 'PUT';
         me.extraRequestParams.poolid = me.pool;
 
-        var vmsField = Ext.create('Ext.form.field.Text', {
+        let vmsField = Ext.create('Ext.form.field.Text', {
             name: 'vms',
             hidden: true,
             allowBlank: false,
@@ -32,7 +32,7 @@ Ext.define('PVE.pool.AddVM', {
         let basicFilter = (data) =>
             (data.type === 'lxc' || data.type === 'qemu') && data.pool !== me.pool;
 
-        var vmStore = Ext.create('Ext.data.Store', {
+        let vmStore = Ext.create('Ext.data.Store', {
             model: 'PVEResources',
             sorters: [
                 {
@@ -43,7 +43,7 @@ Ext.define('PVE.pool.AddVM', {
             filters: [(item) => basicFilter(item.data)],
         });
 
-        var vmGrid = Ext.create('widget.grid', {
+        let vmGrid = Ext.create('widget.grid', {
             store: vmStore,
             border: true,
             height: 480,
@@ -53,7 +53,7 @@ Ext.define('PVE.pool.AddVM', {
                 mode: 'SIMPLE',
                 listeners: {
                     selectionchange: function (model, selected, opts) {
-                        var selectedVms = [];
+                        let selectedVms = [];
                         selected.forEach(function (vm) {
                             selectedVms.push(vm.data.vmid);
                         });
@@ -127,7 +127,7 @@ Ext.define('PVE.pool.AddStorage', {
     extend: 'Proxmox.window.Edit',
 
     initComponent: function () {
-        var me = this;
+        let me = this;
 
         if (!me.pool) {
             throw 'no pool specified';
@@ -166,7 +166,7 @@ Ext.define('PVE.grid.PoolMembers', {
     stateId: 'grid-pool-members',
 
     initComponent: function () {
-        var me = this;
+        let me = this;
 
         if (!me.pool) {
             throw 'no pool specified';
@@ -193,7 +193,7 @@ Ext.define('PVE.grid.PoolMembers', {
             ],
         });
 
-        var coldef = PVE.data.ResourceStore.defaultColumns().filter(
+        let coldef = PVE.data.ResourceStore.defaultColumns().filter(
             (c) => c.dataIndex !== 'tags' && c.dataIndex !== 'lock',
         );
 
@@ -201,9 +201,9 @@ Ext.define('PVE.grid.PoolMembers', {
             me.rstore.load();
         };
 
-        var sm = Ext.create('Ext.selection.RowModel', {});
+        let sm = Ext.create('Ext.selection.RowModel', {});
 
-        var remove_btn = new Proxmox.button.Button({
+        let remove_btn = new Proxmox.button.Button({
             text: gettext('Remove'),
             disabled: true,
             selModel: sm,
@@ -214,7 +214,7 @@ Ext.define('PVE.grid.PoolMembers', {
                 );
             },
             handler: function (btn, event, rec) {
-                var params = { delete: 1, poolid: me.pool };
+                let params = { delete: 1, poolid: me.pool };
                 if (rec.data.type === 'storage') {
                     params.storage = rec.data.storage;
                 } else if (
@@ -254,7 +254,7 @@ Ext.define('PVE.grid.PoolMembers', {
                                 text: gettext('Virtual Machine'),
                                 iconCls: 'fa fa-desktop',
                                 handler: function () {
-                                    var win = Ext.create('PVE.pool.AddVM', { pool: me.pool });
+                                    let win = Ext.create('PVE.pool.AddVM', { pool: me.pool });
                                     win.on('destroy', reload);
                                     win.show();
                                 },
@@ -263,7 +263,7 @@ Ext.define('PVE.grid.PoolMembers', {
                                 text: gettext('Storage'),
                                 iconCls: 'fa fa-hdd-o',
                                 handler: function () {
-                                    var win = Ext.create('PVE.pool.AddStorage', { pool: me.pool });
+                                    let win = Ext.create('PVE.pool.AddStorage', { pool: me.pool });
                                     win.on('destroy', reload);
                                     win.show();
                                 },
@@ -280,7 +280,7 @@ Ext.define('PVE.grid.PoolMembers', {
             listeners: {
                 itemcontextmenu: PVE.Utils.createCmdMenu,
                 itemdblclick: function (v, record) {
-                    var ws = me.up('pveStdWorkspace');
+                    let ws = me.up('pveStdWorkspace');
                     ws.selectById(record.data.id);
                 },
                 activate: reload,
-- 
2.47.3





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

* [PATCH pve-manager v4 5/6] fix #7294: api: pool: add SDN VNets as pool members
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (3 preceding siblings ...)
  2026-11-18 11:57 ` [PATCH pve-manager v4 4/6] ui: replace var with let to match style guide for variable declaration David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-18 11:57 ` [PATCH pve-manager v4 6/6] fix #7294: ui: " David Riley
  2026-11-19 12:49 ` superseded: [PATCH access-control/manager/network v4 0/6] fix #7294: " David Riley
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Extend the pool API to accept SDN VNets as pool members under the
'network' parameter.

Accept comma-separated lists of network resources for VNets. These can
include optional VLAN tags or a wildcard (*) to propagate access to
all untagged and tagged traffic.

Unlike VMs or containers which strictly belong to a single pool, VNets
are shared similar to storage. A single VNet can be assigned to
multiple pools simultaneously, allowing cross-team usage without
management conflicts.

Enforce a cluster-wide version check before allowing network
assignments. This prevents older nodes from accidentally overwriting
the newly structured pool configurations.

Suggested-by: Daniel Kral <d.kral@proxmox.com>
Signed-off-by: David Riley <d.riley@proxmox.com>

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294
---
 PVE/API2/Pool.pm | 151 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 146 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm
index f1f67e84..72bdb501 100644
--- a/PVE/API2/Pool.pm
+++ b/PVE/API2/Pool.pm
@@ -7,7 +7,12 @@ use PVE::AccessControl;
 use PVE::Cluster qw (cfs_read_file cfs_write_file);
 use PVE::Exception qw(raise_param_exc);
 use PVE::INotify;
+use PVE::JSONSchema;
+use PVE::Network;
+use PVE::Network::SDN::Vnets;
+use PVE::Network::SDN::Zones;
 use PVE::Storage;
+use PVE::Tools;
 
 use PVE::SafeSyslog;
 
@@ -16,6 +21,42 @@ use PVE::RESTHandler;
 
 use base qw(PVE::RESTHandler);
 
+use constant NETWORK_VNET_REGEX => qr!^vnet/([^/]+)/([^/]+)(?:/([0-9]+|\*))?$!;
+
+sub pve_verify_pool_network {
+    my ($value, $noerr) = @_;
+
+    if ($value =~ NETWORK_VNET_REGEX) {
+        my ($zone, $vnet, $tag) = ($1, $2, $3);
+
+        eval { PVE::JSONSchema::check_format('pve-sdn-zone-id', $zone) };
+        if ($@) {
+            return undef if $noerr;
+            die "invalid SDN zone ID '$zone'\n";
+        }
+
+        eval { PVE::JSONSchema::check_format('pve-sdn-vnet-id', $vnet) };
+        if ($@) {
+            return undef if $noerr;
+            die "invalid SDN vnet ID '$vnet'\n";
+        }
+
+        if (defined($tag) && $tag ne '*') {
+            if ($tag < 1 || $tag > 4094) {
+                return undef if $noerr;
+                die "vlan tag '$tag' out of range (1-4094)\n";
+            }
+        }
+
+        return $value;
+    }
+
+    return undef if $noerr;
+    die "value '$value' is not a valid pool network vnet string (<type>/<zone>/<vnet>[/<tag>|*])\n";
+}
+
+PVE::JSONSchema::register_format('pve-pool-network', \&pve_verify_pool_network);
+
 __PACKAGE__->register_method({
     name => 'index',
     path => '',
@@ -36,7 +77,7 @@ __PACKAGE__->register_method({
             },
             type => {
                 type => 'string',
-                enum => ['qemu', 'lxc', 'storage'],
+                enum => ['qemu', 'lxc', 'storage', 'network'],
                 optional => 1,
                 requires => 'poolid',
             },
@@ -61,7 +102,7 @@ __PACKAGE__->register_method({
                         properties => {
                             type => {
                                 type => 'string',
-                                enum => ['qemu', 'lxc', 'openvz', 'storage'],
+                                enum => ['qemu', 'lxc', 'openvz', 'storage', 'network'],
                             },
                             id => {
                                 type => 'string',
@@ -135,6 +176,27 @@ __PACKAGE__->register_method({
                 }
             }
 
+            if (!defined($param->{type}) || $param->{type} eq 'network') {
+                for my $net_key (sort keys $pool_config->{network}->%*) {
+                    my ($type, @path) = split('/', $net_key);
+
+                    if ($type eq 'vnet') {
+                        my ($zoneid, $vnet, $tag) = @path;
+
+                        my $description = "$vnet ($zoneid)";
+                        $description = "$vnet.$tag ($zoneid)" if defined($tag);
+
+                        push @$members,
+                            {
+                                type => 'network',
+                                'network-type' => $type,
+                                id => $net_key,
+                                text => $description,
+                            };
+                    }
+                }
+            }
+
             my $pool_info = {
                 members => $members,
             };
@@ -243,6 +305,13 @@ __PACKAGE__->register_method({
                 format => 'pve-storage-id-list',
                 optional => 1,
             },
+            network => {
+                description => 'Network resource to add or remove from this pool.',
+                type => 'string',
+                typetext => '<type>/<zone>/<vnet>[/<tag>|*]',
+                format => 'pve-pool-network-list',
+                optional => 1,
+            },
             'allow-move' => {
                 description => 'Allow adding a guest even if already in another pool.'
                     . ' The guest will be removed from its current pool and added to this one.',
@@ -295,6 +364,13 @@ __PACKAGE__->register_method({
                 format => 'pve-storage-id-list',
                 optional => 1,
             },
+            network => {
+                description => 'Network resource to add or remove from this pool.',
+                type => 'string',
+                typetext => '<type>/<zone>/<vnet>[/<tag>|*]',
+                format => 'pve-pool-network-list',
+                optional => 1,
+            },
             'allow-move' => {
                 description => 'Allow adding a guest even if already in another pool.'
                     . ' The guest will be removed from its current pool and added to this one.',
@@ -304,7 +380,7 @@ __PACKAGE__->register_method({
             },
             delete => {
                 description =>
-                    'Remove the passed VMIDs and/or storage IDs instead of adding them.',
+                    'Remove the passed VMIDs, storage IDs and/or network resource instead of adding them.',
                 type => 'boolean',
                 optional => 1,
                 default => 0,
@@ -373,6 +449,63 @@ __PACKAGE__->register_method({
                     }
                 }
 
+                if (defined($param->{network})) {
+                    # FIXME: MAJOR VERSION: 10.0 remove gatekeeper
+                    # gatekeep vnet as pool members
+                    PVE::Cluster::assert_min_cluster_version(9, 2, 30);
+
+                    my $network_param = $param->{network};
+                    my $zones_cfg = PVE::Network::SDN::Zones::config();
+                    my $vnets_cfg = PVE::Network::SDN::Vnets::config();
+
+                    for my $network (PVE::Tools::split_list($network_param)) {
+                        if ($network =~ NETWORK_VNET_REGEX) {
+                            my ($zone, $vnetid, $tag) = ($1, $2, $3);
+
+                            die "SDN Zone '$zone' does not exist\n"
+                                if !$zones_cfg->{ids}->{$zone};
+
+                            my $vnet_data = $vnets_cfg->{ids}->{$vnetid}
+                                or die "VNet '$vnetid' does not exist\n";
+
+                            my $vnet_zone = $vnet_data->{zone};
+                            if ($zone ne $vnet_zone) {
+                                die
+                                    "VNet '$vnetid' does not belong to zone '$zone' (it belongs to '$vnet_zone')\n";
+                            }
+
+                            my $network_key = "vnet/$vnet_zone/$vnetid";
+                            my $acl_path = "/sdn/zones/$vnet_zone/$vnetid";
+
+                            if (defined($tag)) {
+                                $network_key .= "/$tag";
+                                $acl_path .= "/$tag" if $tag ne "*";
+                            }
+
+                            $rpcenv->check_perm_modify($authuser, $acl_path);
+
+                            if ($param->{delete}) {
+                                die "Network resource '$network_key' is not a pool member\n"
+                                    if !$pool_config->{network}->{$network_key};
+
+                                delete $pool_config->{network}->{$network_key};
+                            } else {
+                                if (defined($tag) && !$vnet_data->{vlanaware}) {
+                                    die
+                                        "VNet '$vnetid' is not VLAN-aware, cannot assign a specific tag\n";
+                                }
+
+                                die
+                                    "Network resource '$network_key' is already a pool member\n"
+                                    if ($pool_config->{network}->{$network_key});
+
+                                $pool_config->{network}->{$network_key} = 1;
+                            }
+
+                        }
+                    }
+                }
+
                 cfs_write_file("user.cfg", $usercfg);
             },
             "update pools failed",
@@ -400,7 +533,7 @@ __PACKAGE__->register_method({
             },
             type => {
                 type => 'string',
-                enum => ['qemu', 'lxc', 'storage'],
+                enum => ['qemu', 'lxc', 'storage', 'network'],
                 optional => 1,
             },
         },
@@ -421,7 +554,7 @@ __PACKAGE__->register_method({
                     properties => {
                         type => {
                             type => 'string',
-                            enum => ['qemu', 'lxc', 'openvz', 'storage'],
+                            enum => ['qemu', 'lxc', 'openvz', 'storage', 'network'],
                         },
                         id => {
                             type => 'string',
@@ -524,6 +657,14 @@ __PACKAGE__->register_method({
                     die "pool '$pool' is not empty (contains storage '$storeid')\n";
                 }
 
+                for my $netid (sort keys $pool_config->{network}->%*) {
+                    my ($type, $id) = split('/', $netid, 2);
+                    $type = 'network' if !defined($type);
+                    $id = $netid if !defined($id);
+
+                    die "pool '$pool' is not empty (contains $type '$id')\n";
+                }
+
                 delete($usercfg->{pools}->{$pool});
                 PVE::AccessControl::delete_pool_acl($pool, $usercfg);
 
-- 
2.47.3





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

* [PATCH pve-manager v4 6/6] fix #7294: ui: pool: add SDN VNets as pool members
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (4 preceding siblings ...)
  2026-11-18 11:57 ` [PATCH pve-manager v4 5/6] fix #7294: api: pool: add SDN VNets as pool members David Riley
@ 2026-11-18 11:57 ` David Riley
  2026-11-19 12:49 ` superseded: [PATCH access-control/manager/network v4 0/6] fix #7294: " David Riley
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-18 11:57 UTC (permalink / raw)
  To: pve-devel

Add user interface to manage SDN VNets inside resource pools.
In the dialog window users can select an SDN zone, pick an associated
VNet, and optionally specify a VLAN tag or enable propagation to grant
full access to all tagged and untagged traffic.

The VNet selector only shows VNets of the selected zone to prevent
invalid configurations.

Add opacity adjustments for the `fa-network-wired` icon used by pool
networks. The light/base theme lowers the icons opacity to simulate
a light grey color that matches other configuration elements.

Signed-off-by: David Riley <d.riley@proxmox.com>

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7294
---
 www/css/ext6-pve.css             |  15 ++++
 www/manager6/Utils.js            |   1 +
 www/manager6/grid/PoolMembers.js | 145 +++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+)

diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index b1e0b4f8..2416bc05 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -464,6 +464,21 @@ div.right-aligned {
     content: " ";
 }
 
+.x-fa-pool-net:before {
+    width: 14px;
+    height: 14px;
+    position: absolute;
+    left: 1px;
+    top: 1px;
+    opacity: 0.45;
+}
+
+.x-fa-pool-net-grid:before {
+    left: 14px;
+    top: 6px;
+    opacity: 0.65;
+}
+
 .x-fa-treepanel:before {
     width: 16px;
     height: 24px;
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index c616ab9b..0f7c14ef 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1355,6 +1355,7 @@ Ext.define('PVE.Utils', {
                 const networkTypeMapping = {
                     fabric: 'fa fa-road',
                     zone: 'fa fa-th',
+                    vnet: 'fa fa-network-wired x-fa-pool-net x-fa-pool-net-grid',
                 };
 
                 return networkTypeMapping[record['network-type']] ?? '';
diff --git a/www/manager6/grid/PoolMembers.js b/www/manager6/grid/PoolMembers.js
index 69f50e30..b3153007 100644
--- a/www/manager6/grid/PoolMembers.js
+++ b/www/manager6/grid/PoolMembers.js
@@ -158,6 +158,128 @@ Ext.define('PVE.pool.AddStorage', {
     },
 });
 
+Ext.define('PVE.pool.AddVnet', {
+    extend: 'Proxmox.window.Edit',
+
+    viewModel: {
+        data: {
+            zone: '',
+        },
+        formulas: {
+            vnetDisabled: function (get) {
+                return !get('zone');
+            },
+        },
+    },
+
+    initComponent: function () {
+        let me = this;
+
+        if (!me.pool) {
+            throw 'no pool specified';
+        }
+
+        me.isCreate = true;
+        me.isAdd = true;
+        me.url = '/pools/';
+        me.method = 'PUT';
+        me.extraRequestParams.poolid = me.pool;
+
+        Ext.apply(me, {
+            subject: gettext('VNet'),
+            width: 350,
+            items: [
+                {
+                    xtype: 'inputpanel',
+                    onGetValues: function (values) {
+                        let network = `vnet/${values.zone}/${values.vnet}`;
+
+                        if (values.propagate) {
+                            network += '/*';
+                        } else if (values.tag) {
+                            network += `/${values.tag}`;
+                        }
+
+                        delete values.zone;
+                        delete values.vnet;
+                        delete values.propagate;
+                        delete values.tag;
+
+                        values.network = network;
+
+                        return values;
+                    },
+                    items: [
+                        {
+                            xtype: 'pveSDNZoneSelector',
+                            fieldLabel: gettext('Zone'),
+                            name: 'zone',
+                            allowBlank: false,
+                            bind: {
+                                value: '{zone}',
+                            },
+                            listeners: {
+                                change: function (_f, _value) {
+                                    let vnetField = me.lookupReference('vnetField');
+                                    if (vnetField) {
+                                        vnetField.setValue('');
+                                    }
+                                },
+                            },
+                        },
+                        {
+                            xtype: 'pveSDNVnetSelector',
+                            fieldLabel: gettext('VNet'),
+                            name: 'vnet',
+                            reference: 'vnetField',
+                            allowBlank: false,
+                            bind: {
+                                disabled: '{vnetDisabled}',
+                            },
+                            listeners: {
+                                beforequery: function (_queryPlan) {
+                                    let zone = me.getViewModel().get('zone');
+                                    let store = this.getStore();
+                                    store.clearFilter();
+                                    store.filter('zone', zone);
+                                    return true;
+                                },
+                            },
+                        },
+                        {
+                            xtype: 'proxmoxintegerfield',
+                            name: 'tag',
+                            fieldLabel: gettext('VLAN Tag'),
+                            minValue: 1,
+                            maxValue: 4094,
+                            allowBlank: true,
+                            emptyText: gettext('untagged'),
+                            bind: {
+                                disabled: '{propagate}',
+                            },
+                        },
+                        {
+                            xtype: 'proxmoxcheckbox',
+                            name: 'propagate',
+                            checked: false,
+                            uncheckedValue: 0,
+                            fieldLabel: gettext('Propagate'),
+                            boxLabel: gettext(
+                                'Grant full access to this VNet (tagged and untagged)',
+                            ),
+                            bind: {
+                                value: '{propagate}',
+                            },
+                        },
+                    ],
+                },
+            ],
+        });
+
+        me.callParent();
+    },
+});
+
 Ext.define('PVE.grid.PoolMembers', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pvePoolMembers'],
@@ -223,6 +345,20 @@ Ext.define('PVE.grid.PoolMembers', {
                     rec.data.type === 'openvz'
                 ) {
                     params.vms = rec.data.vmid;
+                } else if (rec.get('type') === 'network') {
+                    if (rec.get('network-type') === 'vnet') {
+                        let [_type, zone, vnet, tag] = rec.data.id.split('/');
+
+                        let network = `vnet/${zone}/${vnet}`;
+
+                        if (tag) {
+                            network += `/${tag}`;
+                        }
+
+                        params.network = network;
+                    } else {
+                        console.warn('unknown network-type encountered');
+                    }
                 } else {
                     throw 'unknown resource type';
                 }
@@ -268,6 +404,15 @@ Ext.define('PVE.grid.PoolMembers', {
                                     win.show();
                                 },
                             },
+                            {
+                                text: gettext('VNet'),
+                                iconCls: 'fa fa-network-wired x-fa-pool-net',
+                                handler: function () {
+                                    let win = Ext.create('PVE.pool.AddVnet', { pool: me.pool });
+                                    win.on('destroy', reload);
+                                    win.show();
+                                },
+                            },
                         ],
                     }),
                 },
-- 
2.47.3





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

* superseded: [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members
  2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (5 preceding siblings ...)
  2026-11-18 11:57 ` [PATCH pve-manager v4 6/6] fix #7294: ui: " David Riley
@ 2026-11-19 12:49 ` David Riley
  6 siblings, 0 replies; 8+ messages in thread
From: David Riley @ 2026-11-19 12:49 UTC (permalink / raw)
  To: pve-devel

superseded by:
https://lore.proxmox.com/pve-devel/20261119124731.84602-1-d.riley@proxmox.com/





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

end of thread, other threads:[~2026-11-19 12:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 11:57 [PATCH access-control/manager/network v4 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
2026-11-18 11:57 ` [PATCH pve-access-control v4 1/6] rpcenv: add SDN.Allocate to modify permission check David Riley
2026-11-18 11:57 ` [PATCH pve-network v4 2/6] sdn: register api formats for zones and vnets David Riley
2026-11-18 11:57 ` [PATCH pve-network v4 3/6] fix #7294: sdn: vnet: update pool members on vnet migration and deletion David Riley
2026-11-18 11:57 ` [PATCH pve-manager v4 4/6] ui: replace var with let to match style guide for variable declaration David Riley
2026-11-18 11:57 ` [PATCH pve-manager v4 5/6] fix #7294: api: pool: add SDN VNets as pool members David Riley
2026-11-18 11:57 ` [PATCH pve-manager v4 6/6] fix #7294: ui: " David Riley
2026-11-19 12:49 ` superseded: [PATCH access-control/manager/network v4 0/6] fix #7294: " David Riley

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