From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 95A291FF0C0 for ; Wed, 18 Nov 2026 07:59:16 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B250621B96; Wed, 18 Nov 2026 07:54:18 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v6 manager 37/42] ui: node: san: show iSCSI targets and sessions Date: Wed, 18 Nov 2026 07:52:54 +0100 Message-ID: <20261118065302.3033937-38-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118065302.3033937-1-t.lamprecht@proxmox.com> References: <20261118065302.3033937-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: 1794984789263 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.178 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: AL4XSJCHFAD4Z7UU6X5U6LNYSPLUCQWA X-Message-ID-Hash: AL4XSJCHFAD4Z7UU6X5U6LNYSPLUCQWA 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 show how a node is connected to an iSCSI target. Add a view below 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. If open-iscsi is not installed, the view says so instead of showing an empty tree. Signed-off-by: Dietmar Maurer [TL: keep the view read-only, without rescan, logout, record removal and session details; add the search field; 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 | 150 ++++++++++++++++++++++++++++++ 4 files changed, 170 insertions(+), 7 deletions(-) create mode 100644 www/manager6/node/ISCSITargets.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 14020e8db..4a6c8af72 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 564c87374..9f11aa0f7 100644 --- a/www/manager6/SANUtils.js +++ b/www/manager6/SANUtils.js @@ -97,6 +97,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..23cb7d0ff --- /dev/null +++ b/www/manager6/node/ISCSITargets.js @@ -0,0 +1,150 @@ +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); + me.sessions = res.result.data; + me.updateTree(); + }, + }); + }, + }); + }, + + // Shows the loaded portals that match the search text, in one of their own values or in a + // device of their session, below their targets. + updateTree: function () { + let me = this; + if (!me.sessions) { + return; + } + let query = (me.down('pveRecordSearchField').getValue() ?? '').toLowerCase(); + let matches = (row) => + !query || + [row.target, row.portal, row['used-by-storage'], ...row.devices.map((d) => d.devpath)] + .filter(Boolean) + .some((value) => value.toLowerCase().includes(query)); + let targets = {}; + for (let row of me.sessions.filter(matches)) { + 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 = { + overflowHandler: 'scroller', + items: [ + { 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()), + }, + ' ', + gettext('Search') + ':', + ' ', + { + xtype: 'pveRecordSearchField', + emptyText: gettext('Target, Portal, Storage'), + listeners: { searchchange: () => me.updateTree() }, + }, + ], + }; + me.callParent(); + }, +});