public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: David Riley <d.riley@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager v4 6/6] fix #7294: ui: pool: add SDN VNets as pool members
Date: Wed, 18 Nov 2026 12:57:57 +0100	[thread overview]
Message-ID: <20261118115757.94919-7-d.riley@proxmox.com> (raw)
In-Reply-To: <20261118115757.94919-1-d.riley@proxmox.com>

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





  parent reply	other threads:[~2026-11-18 11:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` David Riley [this message]
2026-11-19 12:49 ` superseded: [PATCH access-control/manager/network v4 0/6] fix #7294: " David Riley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261118115757.94919-7-d.riley@proxmox.com \
    --to=d.riley@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal