all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members
@ 2026-11-19 12:47 David Riley
  2026-11-19 12:47 ` [PATCH pve-access-control v5 1/6] rpcenv: allow SDN.Allocate to modify permissions on SDN paths David Riley
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Riley @ 2026-11-19 12:47 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 v4:
- Fix: validate VNet additions against the running SDN config
- Fix: only run the cluster version and existence checks when adding
  VNets, so stale entries can always be removed
- Fix: check permissions before the existence checks
- Fix: require 'Permissions.Modify' or propagated 'SDN.Allocate' to
  add a VNet with the '*' wildcard
- Fix: reject VLAN tags with leading zeros, which the user.cfg parser
  silently dropped
- Fix: 'pveum pool list --poolid <pool>' failing result verification
  for pools with VNet members
- Fix: format hint and validator errors of the 'network' parameter
- Fix: filter the VNet selector by exact zone instead of by prefix
- Fix: reword the VLAN tag hint to 'Untagged network devices only'
- Add: describe the effect on the ACL API in the commit message
  (Patch 1/6)
- Refactor: pass the member ID directly when removing a VNet in the UI
- Reword: error messages, commit messages and trailers

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 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: allow SDN.Allocate to modify permissions on SDN paths

 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 zone change 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                 | 176 ++++++++++++++++++++++++++++++-
 www/css/ext6-pve.css             |  15 +++
 www/manager6/Utils.js            |   1 +
 www/manager6/grid/PoolMembers.js | 170 ++++++++++++++++++++++++++---
 4 files changed, 343 insertions(+), 19 deletions(-)


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

-- 
Generated by murpp 0.11.0




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

* [PATCH pve-access-control v5 1/6] rpcenv: allow SDN.Allocate to modify permissions on SDN paths
  2026-11-19 12:47 [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
@ 2026-11-19 12:47 ` David Riley
  2026-11-19 12:47 ` [PATCH pve-network v5 2/6] sdn: register api formats for zones and vnets David Riley
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Riley @ 2026-11-19 12:47 UTC (permalink / raw)
  To: pve-devel

Modifying permissions on a path requires 'Permissions.Modify' on that
path. Some paths accept another privilege on the same path instead:
'VM.Allocate' on /vms/<vmid>, 'Datastore.Allocate' on
/storage/<storage> and 'Pool.Allocate' on /pool/<pool>. SDN paths had
no such exception, so adding a VNet to a resource pool required
'Permissions.Modify', even for users who are allowed to allocate the
VNet itself.

Accept 'SDN.Allocate' on paths below /sdn in the same way. Besides the
pool API, this also affects the ACL API. Users with 'SDN.Allocate' on
an SDN path, for example via the PVESDNAdmin role, can now view and
change the ACLs on that path. As with the other exceptions, they can
only grant or revoke a subset of their own privileges, and only grant
with propagation where their own privileges propagate.

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] 7+ messages in thread

* [PATCH pve-network v5 2/6] sdn: register api formats for zones and vnets
  2026-11-19 12:47 [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
  2026-11-19 12:47 ` [PATCH pve-access-control v5 1/6] rpcenv: allow SDN.Allocate to modify permissions on SDN paths David Riley
@ 2026-11-19 12:47 ` David Riley
  2026-11-19 12:47 ` [PATCH pve-network v5 3/6] fix #7294: sdn: vnet: update pool members on VNet zone change and deletion David Riley
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Riley @ 2026-11-19 12:47 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] 7+ messages in thread

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

When applying the SDN configuration, update user.cfg so that pool
member entries for any VNet moved to another zone reflect the new
zone. Additionally, remove pool entries for deleted VNets.

Otherwise, pools would keep entries for VNets that no longer exist
under that zone and name, and such a stale entry would grant access to
a VNet created later with the same zone and name.

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] 7+ messages in thread

* [PATCH pve-manager v5 4/6] ui: replace var with let to match style guide for variable declaration
  2026-11-19 12:47 [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (2 preceding siblings ...)
  2026-11-19 12:47 ` [PATCH pve-network v5 3/6] fix #7294: sdn: vnet: update pool members on VNet zone change and deletion David Riley
@ 2026-11-19 12:47 ` David Riley
  2026-11-19 12:47 ` [PATCH pve-manager v5 5/6] fix #7294: api: pool: add SDN VNets as pool members David Riley
  2026-11-19 12:47 ` [PATCH pve-manager v5 6/6] fix #7294: ui: " David Riley
  5 siblings, 0 replies; 7+ messages in thread
From: David Riley @ 2026-11-19 12:47 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] 7+ messages in thread

* [PATCH pve-manager v5 5/6] fix #7294: api: pool: add SDN VNets as pool members
  2026-11-19 12:47 [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
                   ` (3 preceding siblings ...)
  2026-11-19 12:47 ` [PATCH pve-manager v5 4/6] ui: replace var with let to match style guide for variable declaration David Riley
@ 2026-11-19 12:47 ` David Riley
  2026-11-19 12:47 ` [PATCH pve-manager v5 6/6] fix #7294: ui: " David Riley
  5 siblings, 0 replies; 7+ messages in thread
From: David Riley @ 2026-11-19 12:47 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 | 176 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 171 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Pool.pm b/PVE/API2/Pool.pm
index f1f67e84..9a51559f 100644
--- a/PVE/API2/Pool.pm
+++ b/PVE/API2/Pool.pm
@@ -7,7 +7,11 @@ 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::SDN::Vnets;
+use PVE::Network::SDN::Zones;
 use PVE::Storage;
+use PVE::Tools;
 
 use PVE::SafeSyslog;
 
@@ -16,6 +20,37 @@ use PVE::RESTHandler;
 
 use base qw(PVE::RESTHandler);
 
+use constant NETWORK_VNET_REGEX => qr!^vnet/([^/]+)/([^/]+)(?:/([1-9][0-9]{0,3}|\*))?$!;
+
+sub pve_verify_pool_network {
+    my ($value, $noerr) = @_;
+
+    if ($value !~ NETWORK_VNET_REGEX) {
+        return undef if $noerr;
+        die "Value '$value' is not a valid pool network vnet string"
+            . " (vnet/<zone>/<vnet>[/<tag>|/*])\n";
+    }
+    my ($zone, $vnet, $tag) = ($1, $2, $3);
+
+    eval {
+        PVE::JSONSchema::check_format('pve-sdn-zone-id', $zone);
+        PVE::JSONSchema::check_format('pve-sdn-vnet-id', $vnet);
+
+        if (defined($tag) && $tag ne '*' && $tag > 4094) {
+            die "VLAN tag '$tag' out of range (1-4094)\n";
+        }
+    };
+
+    if (my $err = $@) {
+        return undef if $noerr;
+        die $err;
+    }
+
+    return $value;
+}
+
+PVE::JSONSchema::register_format('pve-pool-network', \&pve_verify_pool_network);
+
 __PACKAGE__->register_method({
     name => 'index',
     path => '',
@@ -36,7 +71,7 @@ __PACKAGE__->register_method({
             },
             type => {
                 type => 'string',
-                enum => ['qemu', 'lxc', 'storage'],
+                enum => ['qemu', 'lxc', 'storage', 'network'],
                 optional => 1,
                 requires => 'poolid',
             },
@@ -61,13 +96,14 @@ __PACKAGE__->register_method({
                         properties => {
                             type => {
                                 type => 'string',
-                                enum => ['qemu', 'lxc', 'openvz', 'storage'],
+                                enum => ['qemu', 'lxc', 'openvz', 'storage', 'network'],
                             },
                             id => {
                                 type => 'string',
                             },
                             node => {
                                 type => 'string',
+                                optional => 1,
                             },
                             vmid => {
                                 type => 'integer',
@@ -77,6 +113,13 @@ __PACKAGE__->register_method({
                                 type => 'string',
                                 optional => 1,
                             },
+                            'network-type' => {
+                                type => 'string',
+                                enum => ['vnet'],
+                                optional => 1,
+                                description =>
+                                    'Type of the network resource (only for network members).',
+                            },
                         },
                     },
                 },
@@ -135,6 +178,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 +307,13 @@ __PACKAGE__->register_method({
                 format => 'pve-storage-id-list',
                 optional => 1,
             },
+            network => {
+                description => 'List of network resources to add or remove from this pool.',
+                type => 'string',
+                typetext => 'vnet/<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 +366,13 @@ __PACKAGE__->register_method({
                 format => 'pve-storage-id-list',
                 optional => 1,
             },
+            network => {
+                description => 'List of network resources to add or remove from this pool.',
+                type => 'string',
+                typetext => 'vnet/<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 +382,8 @@ __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 resources instead of'
+                    . ' adding them.',
                 type => 'boolean',
                 optional => 1,
                 default => 0,
@@ -373,6 +452,77 @@ __PACKAGE__->register_method({
                     }
                 }
 
+                if (defined($param->{network})) {
+                    if (!$param->{delete}) {
+                        # FIXME: MAJOR VERSION: 10.0 remove gatekeeper
+                        # nodes without support for network pool members drop them when
+                        # rewriting user.cfg, so all nodes must support them before adding
+                        PVE::Cluster::assert_min_cluster_version(9, 2, 30);
+                    }
+
+                    my $zones_cfg = PVE::Network::SDN::Zones::config(1);
+                    my $vnets_cfg = PVE::Network::SDN::Vnets::config(1);
+
+                    my $network_param = $param->{network};
+                    for my $network (PVE::Tools::split_list($network_param)) {
+                        next if $network !~ NETWORK_VNET_REGEX;
+                        my ($zone, $vnetid, $tag) = ($1, $2, $3);
+
+                        my $network_key = "vnet/$zone/$vnetid";
+                        my $acl_path = "/sdn/zones/$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};
+                            next;
+                        }
+
+                        die "SDN zone '$zone' does not exist or is not applied\n"
+                            if !$zones_cfg->{ids}->{$zone};
+
+                        my $vnet_data = $vnets_cfg->{ids}->{$vnetid}
+                            or die "VNet '$vnetid' does not exist or is not applied\n";
+
+                        die "VNet '$vnetid' does not belong to zone '$zone'\n"
+                            if $zone ne $vnet_data->{zone};
+
+                        die
+                            "VNet '$vnetid' is not VLAN-aware, cannot assign a specific VLAN tag\n"
+                            if (defined($tag) && !$vnet_data->{vlanaware});
+
+                        # a wildcard grants the pool's roles on all tags of the VNet, so the
+                        # user's SDN.Allocate must propagate to them
+                        if (defined($tag) && $tag eq '*') {
+                            my $auth_user_privs = $rpcenv->permissions($authuser, $acl_path);
+
+                            if (
+                                !defined($auth_user_privs->{'Permissions.Modify'})
+                                && !$auth_user_privs->{'SDN.Allocate'}
+                            ) {
+                                raise_param_exc({
+                                    network =>
+                                        "Cannot add '$network_key' - requires 'Permissions.Modify'"
+                                        . " or propagated 'SDN.Allocate' on '$acl_path'",
+                                });
+                            }
+                        }
+
+                        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 +550,7 @@ __PACKAGE__->register_method({
             },
             type => {
                 type => 'string',
-                enum => ['qemu', 'lxc', 'storage'],
+                enum => ['qemu', 'lxc', 'storage', 'network'],
                 optional => 1,
             },
         },
@@ -421,13 +571,14 @@ __PACKAGE__->register_method({
                     properties => {
                         type => {
                             type => 'string',
-                            enum => ['qemu', 'lxc', 'openvz', 'storage'],
+                            enum => ['qemu', 'lxc', 'openvz', 'storage', 'network'],
                         },
                         id => {
                             type => 'string',
                         },
                         node => {
                             type => 'string',
+                            optional => 1,
                         },
                         vmid => {
                             type => 'integer',
@@ -437,6 +588,13 @@ __PACKAGE__->register_method({
                             type => 'string',
                             optional => 1,
                         },
+                        'network-type' => {
+                            type => 'string',
+                            enum => ['vnet'],
+                            optional => 1,
+                            description =>
+                                'Type of the network resource (only for network members).',
+                        },
                     },
                 },
             },
@@ -524,6 +682,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] 7+ messages in thread

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

Add a 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 icon's 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 | 142 +++++++++++++++++++++++++++++++
 3 files changed, 158 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..646dd5e4 100644
--- a/www/manager6/grid/PoolMembers.js
+++ b/www/manager6/grid/PoolMembers.js
@@ -158,6 +158,134 @@ Ext.define('PVE.pool.AddStorage', {
     },
 });
 
+Ext.define('PVE.pool.AddVnet', {
+    extend: 'Proxmox.window.Edit',
+
+    viewModel: {
+        data: {
+            zone: '',
+            propagate: false,
+        },
+        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({
+                                        property: 'zone',
+                                        value: zone,
+                                        exactMatch: true,
+                                        caseSensitive: true,
+                                    });
+                                    return true;
+                                },
+                            },
+                        },
+                        {
+                            xtype: 'proxmoxintegerfield',
+                            name: 'tag',
+                            fieldLabel: gettext('VLAN Tag'),
+                            minValue: 1,
+                            maxValue: 4094,
+                            allowBlank: true,
+                            emptyText: gettext('Untagged network devices only'),
+                            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 +351,11 @@ 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') {
+                        throw 'unknown network type';
+                    }
+                    params.network = rec.data.id;
                 } else {
                     throw 'unknown resource type';
                 }
@@ -268,6 +401,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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 12:47 [PATCH access-control/manager/network v5 0/6] fix #7294: pool: add SDN VNets as pool members David Riley
2026-11-19 12:47 ` [PATCH pve-access-control v5 1/6] rpcenv: allow SDN.Allocate to modify permissions on SDN paths David Riley
2026-11-19 12:47 ` [PATCH pve-network v5 2/6] sdn: register api formats for zones and vnets David Riley
2026-11-19 12:47 ` [PATCH pve-network v5 3/6] fix #7294: sdn: vnet: update pool members on VNet zone change and deletion David Riley
2026-11-19 12:47 ` [PATCH pve-manager v5 4/6] ui: replace var with let to match style guide for variable declaration David Riley
2026-11-19 12:47 ` [PATCH pve-manager v5 5/6] fix #7294: api: pool: add SDN VNets as pool members David Riley
2026-11-19 12:47 ` [PATCH pve-manager v5 6/6] fix #7294: ui: " 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