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 14CC41FF0B7 for ; Fri, 13 Nov 2026 04:18:26 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7A7AF21BC8; Fri, 13 Nov 2026 04:05:17 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v4 manager 28/36] ui: dc: add a SAN view Date: Fri, 13 Nov 2026 04:00:46 +0100 Message-ID: <20261113030146.1559030-29-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: 1794538915438 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.236 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: O5IDX54Y7D2D7WAIBM2WRSYN5GUUAH7L X-Message-ID-Hash: O5IDX54Y7D2D7WAIBM2WRSYN5GUUAH7L 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: Admins need to see whether every node reaches each LUN and over how many paths, without running "multipath -ll" on all nodes. Add a SAN view with the multipath state of each node and of each LUN across the cluster. The state of a LUN names the nodes it applies to if those are only some of them, the path counts per node are in a tooltip. A LUN with a single path reads "OK (1 path)" instead of optimal: it works, but has no path to fail over to. The node list includes the iSCSI initiator names, which can be copied for the access rules of an array. The explicit multipath entries and the overrides file are edited from the LUN list, which also shows how the multipath of each LUN is managed: by an explicit entry, by the storage that requests it, or not by Proxmox VE. A plain yes or no for an entry made healthy LUNs of iSCSI storages look unprotected. The view is an entry below Datacenter > Storage, which is expanded by default: it shows what the shared storages of the cluster are built on, and storage is where admins look for it. Signed-off-by: Thomas Lamprecht --- www/manager6/Makefile | 3 + www/manager6/SANUtils.js | 52 +++++ www/manager6/Utils.js | 14 ++ www/manager6/dc/Config.js | 23 +- www/manager6/dc/MultipathWwidEdit.js | 81 +++++++ www/manager6/dc/SAN.js | 312 +++++++++++++++++++++++++++ 6 files changed, 479 insertions(+), 6 deletions(-) create mode 100644 www/manager6/SANUtils.js create mode 100644 www/manager6/dc/MultipathWwidEdit.js create mode 100644 www/manager6/dc/SAN.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index d2ea786be..f268a4d70 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -7,6 +7,7 @@ JSSRC= \ StateProvider.js \ qemu/Architecture.js \ Utils.js \ + SANUtils.js \ UIOptions.js \ Toolkit.js \ VNCConsole.js \ @@ -184,6 +185,7 @@ JSSRC= \ dc/Guests.js \ dc/Health.js \ dc/Log.js \ + dc/MultipathWwidEdit.js \ dc/NodeView.js \ dc/OptionView.js \ dc/PermissionView.js \ @@ -191,6 +193,7 @@ JSSRC= \ dc/PoolView.js \ dc/RoleEdit.js \ dc/RoleView.js \ + dc/SAN.js \ dc/SecurityGroups.js \ dc/StorageView.js \ dc/Summary.js \ diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js new file mode 100644 index 000000000..e83f8533c --- /dev/null +++ b/www/manager6/SANUtils.js @@ -0,0 +1,52 @@ +Ext.define('PVE.SANUtils', { + singleton: true, + + // A LUN with a single path is fine, but has no path to fail over to, so it is not optimal. + lunState: function (state, pathsTotal) { + return state === 'optimal' && Number(pathsTotal) === 1 ? 'single-path' : state; + }, + + // Usable paths of a node out of those it has, or out of those it should have if more. + pathCount: function (report) { + let total = Math.max(report['paths-total'] ?? 0, report['paths-expected'] ?? 0); + return `${report['paths-active']}/${total}`; + }, + + // How the multipath of a LUN is managed, as plain text. + multipathText: function (value, storage) { + if (value === 'storage' && storage) { + return Ext.String.format(gettext('Storage "{0}"'), storage); + } + return ( + { + none: gettext('Not enabled'), + pending: gettext('Pending'), + manual: gettext('Explicit entry'), + storage: gettext('Storage'), + unmanaged: gettext('Unmanaged'), + native: gettext('Native'), + }[value] ?? + value ?? + '' + ); + }, + + renderState: function (value) { + if (!value) { + return ''; + } + let display = { + ok: ['check-circle good', gettext('OK')], + optimal: ['check-circle good', gettext('Optimal')], + 'single-path': ['check-circle good', gettext('OK (1 path)')], + degraded: ['exclamation-circle warning', gettext('Degraded')], + failed: ['times-circle critical', gettext('Failed')], + missing: ['times-circle critical', gettext('Missing')], + unknown: ['question-circle faded', gettext('Unknown')], + unavailable: ['exclamation-circle warning', gettext('Multipath unavailable')], + 'no-report': ['question-circle faded', gettext('No current report')], + }[value]; + let [icon, label] = display ?? ['question-circle faded', value]; + return ` ${Ext.htmlEncode(label)}`; + }, +}); diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 61b8def27..865ba44ff 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -1118,6 +1118,20 @@ Ext.define('PVE.Utils', { return Ext.String.htmlEncode(result); }, + copyToClipboard: function (text) { + let fail = (err) => + Ext.Msg.alert( + gettext('Error'), + Ext.htmlEncode( + Ext.String.format( + gettext('Copying to the clipboard failed: {0}'), + `${err}`, + ), + ), + ); + navigator.clipboard.writeText(text).catch(fail); + }, + render_serverity: function (value) { return PVE.Utils.log_severity_hash[value] || value; }, diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js index 83c48c3d6..65252b9d8 100644 --- a/www/manager6/dc/Config.js +++ b/www/manager6/dc/Config.js @@ -124,12 +124,23 @@ Ext.define('PVE.dc.Config', { } if (caps.storage['Datastore.Allocate'] || caps.dc['Sys.Audit']) { - me.items.push({ - xtype: 'pveStorageView', - title: gettext('Storage'), - iconCls: 'fa fa-database', - itemId: 'storage', - }); + me.items.push( + { + xtype: 'pveStorageView', + title: gettext('Storage'), + iconCls: 'fa fa-database', + itemId: 'storage', + expandedOnInit: true, + }, + // storage admins need the node identities for the target ACLs too + { + xtype: 'pveDcSAN', + title: 'SAN', + iconCls: 'fa fa-cubes', + itemId: 'san', + groups: ['storage'], + }, + ); } if (caps.dc['Sys.Audit']) { diff --git a/www/manager6/dc/MultipathWwidEdit.js b/www/manager6/dc/MultipathWwidEdit.js new file mode 100644 index 000000000..405a5fdbb --- /dev/null +++ b/www/manager6/dc/MultipathWwidEdit.js @@ -0,0 +1,81 @@ +Ext.define('PVE.dc.MultipathWwidEdit', { + extend: 'Proxmox.window.Edit', + subject: gettext('Multipath Entry'), + isAdd: true, + onlineHelp: 'storage_multipath', + width: 520, + fieldDefaults: { labelWidth: 170 }, + + initComponent: function () { + let me = this; + me.method = me.isCreate ? 'POST' : 'PUT'; + me.url = '/cluster/multipath/wwid'; + if (!me.isCreate) { + me.url += `/${encodeURIComponent(me.wwid)}`; + me.autoLoad = true; + me.autoLoadOptions = { + success: (response) => { + let values = response.result.data; + values.nodes = values.nodes ? values.nodes.split(',') : []; + me.setValues(values); + }, + }; + } + me.items = [ + { + xtype: me.isCreate ? 'proxmoxtextfield' : 'displayfield', + name: 'wwid', + fieldLabel: 'WWID', + value: me.wwid, + allowBlank: false, + maxLength: 128, + }, + { + xtype: 'proxmoxtextfield', + name: 'alias', + fieldLabel: gettext('Alias'), + maxLength: 64, + deleteEmpty: !me.isCreate, + }, + { + xtype: 'pveNodeSelector', + name: 'nodes', + fieldLabel: gettext('Nodes'), + emptyText: gettext('All (No restrictions)'), + multiSelect: true, + autoSelect: false, + allowBlank: true, + skipEmptyText: true, + deleteEmpty: !me.isCreate, + }, + { + xtype: 'proxmoxKVComboBox', + name: 'no-path-retry', + fieldLabel: gettext('When All Paths Fail'), + deleteEmpty: !me.isCreate, + editable: true, + value: '__default__', + comboItems: [ + ['__default__', Proxmox.Utils.defaultText], + ['queue', gettext('Queue I/O')], + ['fail', gettext('Fail I/O')], + ], + }, + { + xtype: 'proxmoxintegerfield', + name: 'paths-expected', + fieldLabel: gettext('Expected Paths'), + minValue: 1, + emptyText: Proxmox.Utils.noneText, + deleteEmpty: !me.isCreate, + autoEl: { + tag: 'div', + 'data-qtip': gettext( + 'A node with fewer paths to the LUN shows it as degraded, also after the kernel removed a lost path.', + ), + }, + }, + ]; + me.callParent(); + }, +}); diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js new file mode 100644 index 000000000..2ef60900a --- /dev/null +++ b/www/manager6/dc/SAN.js @@ -0,0 +1,312 @@ +Ext.define('pve-san-status', { + extend: 'Ext.data.Model', + fields: [ + 'id', + 'kind', + 'node', + 'state', + 'error', + 'apply-error', + 'time', + 'iscsi-initiator-name', + 'wwid', + 'name', + 'explicit', + 'multipath-storage', + 'nodes', + 'size', + 'used-by-storage', + ], +}); + +Ext.define('PVE.dc.MultipathOverridesEdit', { + extend: 'Proxmox.window.Edit', + subject: gettext('Multipath Overrides'), + onlineHelp: 'storage_multipath', + width: 600, + autoLoad: true, + method: 'PUT', + url: '/cluster/multipath/overrides', + items: [ + { + xtype: 'textarea', + name: 'overrides', + fieldLabel: gettext('Overrides'), + emptyText: gettext( + 'multipath.conf sections for all nodes, for example a devices section with array settings', + ), + height: 320, + fieldStyle: 'font-family: monospace;', + }, + ], +}); + +Ext.define('PVE.dc.SANView', { + extend: 'Ext.panel.Panel', + xtype: 'pveDcSAN', + onlineHelp: 'storage_multipath', + layout: { type: 'vbox', align: 'stretch' }, + + initComponent: function () { + let me = this; + let caps = Ext.state.Manager.get('GuiCap').dc; + let canModify = !!caps['Sys.Modify']; + let canEdit = canModify && !!caps['Sys.Audit']; + me.rstore = Ext.create('Proxmox.data.UpdateStore', { + storeid: 'dc-san-status', + model: 'pve-san-status', + interval: 5000, + proxy: { + type: 'proxmox', + url: '/api2/json/cluster/multipath/status', + reader: { + type: 'json', + rootProperty: 'data', + transform: function (raw) { + let data = raw.data; + return { + ...raw, + data: [ + ...Object.entries(data.nodes).map(([node, report]) => ({ + ...report, + node, + id: `node/${node}`, + kind: 'node', + })), + ...data.luns.map((lun) => ({ + ...lun, + id: `lun/${lun.wwid}`, + kind: 'lun', + })), + ], + }; + }, + }, + }, + }); + let nodeStore = Ext.create('Proxmox.data.DiffStore', { + rstore: me.rstore, + filters: [{ property: 'kind', value: 'node' }], + sorters: ['node'], + sortAfterUpdate: true, + }); + let lunStore = Ext.create('Proxmox.data.DiffStore', { + rstore: me.rstore, + filters: [{ property: 'kind', value: 'lun' }], + sorters: ['wwid'], + sortAfterUpdate: true, + }); + let reload = () => me.rstore.load(); + let edit = (rec) => + Ext.create('PVE.dc.MultipathWwidEdit', { + wwid: rec?.get('wwid'), + isCreate: !rec, + autoShow: true, + apiCallDone: (success) => success && reload(), + }); + me.items = [ + { + xtype: 'grid', + title: gettext('Nodes'), + store: nodeStore, + flex: 2, + viewConfig: { enableTextSelection: true }, + tbar: [ + { + text: gettext('Copy Initiator Names'), + iconCls: 'fa fa-clipboard', + handler: () => + PVE.Utils.copyToClipboard( + nodeStore + .getRange() + .map((rec) => rec.get('iscsi-initiator-name')) + .filter(Boolean) + .join('\n'), + ), + }, + ], + columns: [ + { + text: gettext('Node'), + dataIndex: 'node', + width: 120, + renderer: Ext.htmlEncode, + }, + { + text: gettext('State'), + dataIndex: 'state', + width: 170, + renderer: PVE.SANUtils.renderState, + }, + { + text: gettext('Message'), + dataIndex: 'error', + flex: 1, + renderer: (value, md, rec) => + [value, rec.get('apply-error')] + .filter(Boolean) + .map(Ext.htmlEncode) + .join('
'), + }, + { + text: gettext('iSCSI Initiator Name'), + dataIndex: 'iscsi-initiator-name', + flex: 2, + renderer: Ext.htmlEncode, + }, + { + text: gettext('Last Report'), + dataIndex: 'time', + width: 160, + renderer: Proxmox.Utils.render_timestamp, + hidden: true, + }, + ], + }, + { + xtype: 'grid', + title: 'LUNs', + store: lunStore, + flex: 3, + viewConfig: { enableTextSelection: true }, + tbar: [ + { text: gettext('Add'), disabled: !canModify, handler: () => edit() }, + { + xtype: 'proxmoxButton', + text: gettext('Edit'), + disabled: true, + enableFn: (rec) => canEdit && !!rec.get('explicit'), + handler: (button) => edit(button.up('grid').getSelection()[0]), + }, + { + xtype: 'proxmoxButton', + text: gettext('Remove'), + disabled: true, + enableFn: (rec) => canModify && !!rec.get('explicit'), + confirmMsg: (rec) => + Ext.String.format( + gettext( + 'Remove the multipath entry for {0}? Existing multipath maps are not removed.', + ), + Ext.htmlEncode(rec.get('name') || rec.get('wwid')), + ), + handler: function (button) { + let rec = button.up('grid').getSelection()[0]; + Proxmox.Utils.API2Request({ + url: `/cluster/multipath/wwid/${encodeURIComponent(rec.get('wwid'))}`, + method: 'DELETE', + waitMsgTarget: me, + failure: (response) => + Ext.Msg.alert(gettext('Error'), response.htmlStatus), + success: reload, + }); + }, + }, + { + text: gettext('Edit Overrides'), + disabled: !canEdit, + handler: () => + Ext.create('PVE.dc.MultipathOverridesEdit', { + autoShow: true, + apiCallDone: (success) => success && reload(), + }), + }, + ], + columns: [ + { + text: gettext('Name'), + dataIndex: 'name', + flex: 2, + renderer: (value, md, rec) => Ext.htmlEncode(value || rec.get('wwid')), + }, + { + text: 'WWID', + dataIndex: 'wwid', + flex: 2, + hidden: true, + renderer: Ext.htmlEncode, + }, + { + text: gettext('State'), + dataIndex: 'state', + flex: 1, + minWidth: 160, + renderer: function (value, md, rec) { + let nodes = Object.entries(rec.get('nodes') || {}) + .map(([node, report]) => [ + node, + PVE.SANUtils.lunState(report.state, report['paths-total']), + report, + ]) + .sort(([a], [b]) => a.localeCompare(b)); + let tip = nodes + .map(([node, nodeState, report]) => { + let state = PVE.SANUtils.renderState(nodeState); + if ( + nodeState !== 'single-path' && + report['paths-active'] !== undefined && + report['paths-total'] !== undefined + ) { + state += ` (${Ext.htmlEncode(PVE.SANUtils.pathCount(report))})`; + } + return `${Ext.htmlEncode(node)}: ${state}`; + }) + .join('
'); + md.tdAttr = `data-qtip="${Ext.htmlEncode(tip)}"`; + if (value === 'optimal' && nodes.some(([, s]) => s === 'single-path')) { + value = 'single-path'; + } + let affected = nodes + .filter(([, s]) => s === value) + .map(([node]) => node); + // name the affected nodes if they are only a part of all + if (value === 'optimal' || affected.length === nodes.length) { + return PVE.SANUtils.renderState(value); + } + let names = Ext.htmlEncode(affected.join(', ')); + if (value === 'single-path') { + let text = Ext.String.format( + Ext.htmlEncode(gettext('OK (1 path on {0})')), + names, + ); + return ` ${text}`; + } + return `${PVE.SANUtils.renderState(value)} (${names})`; + }, + }, + { + text: gettext('Multipath'), + dataIndex: 'explicit', + width: 170, + renderer: (value, md, rec) => { + let storage = rec.get('multipath-storage'); + let kind = value ? 'manual' : storage ? 'storage' : 'unmanaged'; + return Ext.htmlEncode(PVE.SANUtils.multipathText(kind, storage)); + }, + }, + { + text: gettext('Used By'), + dataIndex: 'used-by-storage', + flex: 1, + renderer: Ext.htmlEncode, + }, + { + text: gettext('Size'), + dataIndex: 'size', + width: 100, + renderer: Proxmox.Utils.render_size, + }, + ], + }, + ]; + me.callParent(); + me.query('grid').forEach((grid) => Proxmox.Utils.monStoreErrors(grid, me.rstore)); + me.on('activate', () => me.rstore.startUpdate()); + me.on('deactivate', () => me.rstore.stopUpdate()); + me.on('destroy', () => { + nodeStore.destroy(); + lunStore.destroy(); + me.rstore.destroy(); + }); + }, +});