From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 0BADC1FF0B7 for ; Fri, 13 Nov 2026 04:16:52 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 56D4C21B69; Fri, 13 Nov 2026 04:05:16 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v4 manager 33/36] ui: node: san: show iSCSI targets and sessions Date: Fri, 13 Nov 2026 04:00:51 +0100 Message-ID: <20261113030146.1559030-34-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261113030146.1559030-1-t.lamprecht@proxmox.com> References: <20261113030146.1559030-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794538915774 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.238 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: MIACHS2PWCULE2NYJ2WOR6IM5WUABCSW X-Message-ID-Hash: MIACHS2PWCULE2NYJ2WOR6IM5WUABCSW X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Dietmar Maurer The LUN list cannot explain how a node is connected to an iSCSI target. Add a child view of Node > SAN with the targets, their portals with the session state, and the devices of each session. Portals that the node knows but has no session to are listed as not connected. Show the initiator name of the node with a copy button, as the access rules of an array need it, and a message instead of an empty tree if open-iscsi is not installed. Signed-off-by: Dietmar Maurer [TL: keep the view read-only, without rescan, logout, record removal and session details; reword the commit message accordingly] Signed-off-by: Thomas Lamprecht --- www/manager6/Makefile | 1 + www/manager6/SANUtils.js | 3 + www/manager6/node/Config.js | 23 ++++-- www/manager6/node/ISCSITargets.js | 122 ++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 www/manager6/node/ISCSITargets.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 19433ef9c..7fb4d7944 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -248,6 +248,7 @@ JSSRC= \ node/CmdMenu.js \ node/Config.js \ node/Directory.js \ + node/ISCSITargets.js \ node/LVM.js \ node/LVMThin.js \ node/SANLuns.js \ diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js index a3920db2b..8947d83e5 100644 --- a/www/manager6/SANUtils.js +++ b/www/manager6/SANUtils.js @@ -73,6 +73,9 @@ Ext.define('PVE.SANUtils', { unknown: ['question-circle faded', gettext('Unknown')], unavailable: ['exclamation-circle warning', gettext('Multipath unavailable')], 'no-report': ['question-circle faded', gettext('No current report')], + 'logged-in': ['check-circle good', gettext('Connected')], + recovering: ['exclamation-circle warning', gettext('Reconnecting')], + 'not-connected': ['times-circle faded', gettext('Not connected')], }[value]; let [icon, label] = display ?? ['question-circle faded', value]; return ` ${Ext.htmlEncode(label)}`; diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js index 7b1222817..d4a292d68 100644 --- a/www/manager6/node/Config.js +++ b/www/manager6/node/Config.js @@ -360,14 +360,23 @@ Ext.define('PVE.node.Config', { ); } - // the san-luns read accepts either privilege + // the san-luns and iscsi reads accept either privilege if (caps.nodes['Sys.Audit'] || caps.storage['Datastore.Allocate']) { - me.items.push({ - xtype: 'pveSANLunList', - title: 'SAN', - itemId: 'san', - iconCls: 'fa fa-cubes', - }); + me.items.push( + { + xtype: 'pveSANLunList', + title: 'SAN', + itemId: 'san', + iconCls: 'fa fa-cubes', + }, + { + xtype: 'pveISCSITargetTree', + title: 'iSCSI', + itemId: 'san-iscsi', + iconCls: 'fa fa-bullseye', + groups: ['san'], + }, + ); } if (caps.nodes['Sys.Audit']) { diff --git a/www/manager6/node/ISCSITargets.js b/www/manager6/node/ISCSITargets.js new file mode 100644 index 000000000..428ee948e --- /dev/null +++ b/www/manager6/node/ISCSITargets.js @@ -0,0 +1,122 @@ +Ext.define('PVE.node.ISCSITargetTree', { + extend: 'Ext.tree.Panel', + xtype: 'pveISCSITargetTree', + onlineHelp: 'storage_open_iscsi', + rootVisible: false, + viewConfig: { emptyText: gettext('No iSCSI targets found'), enableTextSelection: true }, + store: { + type: 'tree', + fields: ['text', 'state', 'session-id', 'used-by-storage', 'lun'], + root: { expanded: true, children: [] }, + }, + columns: [ + { + xtype: 'treecolumn', + text: gettext('Target'), + dataIndex: 'text', + flex: 3, + renderer: Ext.htmlEncode, + }, + { + text: gettext('State'), + dataIndex: 'state', + width: 150, + renderer: PVE.SANUtils.renderState, + }, + { text: gettext('Session ID'), dataIndex: 'session-id', width: 100 }, + { text: 'LUN', dataIndex: 'lun', width: 70 }, + { + text: gettext('Connection Storage'), + dataIndex: 'used-by-storage', + flex: 1, + renderer: Ext.htmlEncode, + }, + ], + + reload: function () { + let me = this; + Proxmox.Utils.API2Request({ + url: `/nodes/${me.nodename}/iscsi/status`, + method: 'GET', + waitMsgTarget: me.getView(), + failure: (response) => Proxmox.Utils.setErrorMask(me.getView(), response.htmlStatus), + success: function (response) { + if (me.destroyed) { + return; + } + let status = response.result.data; + me.down('#initiator').setValue(status['initiator-name'] || ''); + if (!status.supported) { + Proxmox.Utils.setErrorMask( + me.getView(), + gettext('open-iscsi is not installed on this node.'), + ); + return; + } + Proxmox.Utils.API2Request({ + url: `/nodes/${me.nodename}/iscsi/target`, + method: 'GET', + waitMsgTarget: me.getView(), + failure: (res) => Proxmox.Utils.setErrorMask(me.getView(), res.htmlStatus), + success: function (res) { + if (me.destroyed) { + return; + } + Proxmox.Utils.setErrorMask(me.getView(), false); + let targets = {}; + for (let row of res.result.data) { + targets[row.target] ??= { + text: row.target, + iconCls: 'fa fa-bullseye', + expanded: true, + children: [], + }; + targets[row.target].children.push({ + text: row.portal, + state: row.state, + 'session-id': row['session-id'], + 'used-by-storage': row['used-by-storage'], + iconCls: 'fa fa-link', + expanded: true, + leaf: !row.devices.length, + children: row.devices.map((device) => ({ + text: device.devpath, + lun: device.lun, + iconCls: 'fa fa-hdd-o', + leaf: true, + })), + }); + } + me.setRootNode({ expanded: true, children: Object.values(targets) }); + }, + }); + }, + }); + }, + + listeners: { + activate: function () { + this.reload(); + }, + }, + + initComponent: function () { + let me = this; + me.nodename = me.pveSelNode.data.node; + me.tbar = [ + { text: gettext('Reload'), iconCls: 'fa fa-refresh', handler: () => me.reload() }, + '->', + { + xtype: 'displayfield', + itemId: 'initiator', + fieldLabel: gettext('Initiator Name'), + }, + { + iconCls: 'fa fa-clipboard', + tooltip: gettext('Copy to Clipboard'), + handler: () => PVE.Utils.copyToClipboard(me.down('#initiator').getValue()), + }, + ]; + me.callParent(); + }, +});