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 669B41FF0DA for ; Thu, 19 Nov 2026 20:55:17 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1762622085; Thu, 19 Nov 2026 20:48:49 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v8 manager 33/43] ui: dc: add a SAN view Date: Thu, 19 Nov 2026 20:46:38 +0100 Message-ID: <20261119194655.3163258-34-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261119194655.3163258-1-t.lamprecht@proxmox.com> References: <20261119194655.3163258-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: 1795117623325 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.150 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: BCGTMUSRDPE2AOF2RTT5FL4KSFE4PCNN X-Message-ID-Hash: BCGTMUSRDPE2AOF2RTT5FL4KSFE4PCNN 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. A LUN state other than optimal names the nodes that report it, unless all nodes of the LUN do. A tooltip has the path counts of all nodes. A node can be in the state Unknown for a LUN, for example without a current report or with multipath unavailable. Such a node does not count for the state of the LUN, but is named after it. A LUN with a single path reads "OK (1 path)" instead of optimal: it works, but has no path to fail over to. The LUN list has the LUNs that Proxmox VE manages or that a storage builds on. A node can have many more maps, for example from a storage plugin with one LUN per guest disk. The node list only counts these other maps. The explicit multipath entries and the overrides file are edited from the LUN list. Its Multipath column says whether an explicit entry, a storage or nothing in Proxmox VE manages the multipath of a LUN. A plain yes or no for an explicit entry would make healthy LUNs of iSCSI storages look unprotected. The node list has the iSCSI initiator names to copy for the access rules of an array. 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 | 60 +++++ www/manager6/Utils.js | 19 ++ www/manager6/dc/Config.js | 23 +- www/manager6/dc/MultipathWwidEdit.js | 81 ++++++ www/manager6/dc/SAN.js | 356 +++++++++++++++++++++++++++ 6 files changed, 536 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 e8e2bd0b4..9f5beb5f1 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..1900386c3 --- /dev/null +++ b/www/manager6/SANUtils.js @@ -0,0 +1,60 @@ +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; + }, + + // Deselects the rows of a grid that the filters of its store hide. The buttons of a toolbar + // act on the selected row, which must not be one that a search does not show. + deselectHidden: function (grid) { + let selModel = grid.getSelectionModel(); + let store = grid.getStore(); + selModel.deselect(selModel.getSelection().filter((rec) => !store.contains(rec))); + }, + + // 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 c616ab9bc..64269755d 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -1130,6 +1130,25 @@ 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}`, + ), + ), + ); + // the browser has no clipboard API for a page that is not served securely + try { + navigator.clipboard.writeText(text).catch(fail); + } catch (err) { + fail(err); + } + }, + 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..b32243fd9 --- /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 than expected shows the LUN as degraded, even after the kernel has 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..5f7b4d8a6 --- /dev/null +++ b/www/manager6/dc/SAN.js @@ -0,0 +1,356 @@ +Ext.define('pve-san-status', { + extend: 'Ext.data.Model', + fields: [ + 'id', + 'kind', + 'node', + 'state', + 'error', + 'apply-error', + 'time', + 'iscsi-initiator-name', + 'other-maps', + '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('Other Maps'), + tooltip: gettext( + 'Maps of the node that the LUN list leaves out. They can still be in use, for example by a storage plugin.', + ), + dataIndex: 'other-maps', + width: 110, + // shown once a node has such maps + hidden: true, + }, + { + text: gettext('Last Report'), + dataIndex: 'time', + width: 160, + renderer: Proxmox.Utils.render_timestamp, + hidden: true, + }, + ], + }, + { + xtype: 'grid', + title: gettext('LUNs'), + itemId: 'luns', + store: lunStore, + flex: 3, + viewConfig: { enableTextSelection: true }, + tbar: { + overflowHandler: 'scroller', + items: [ + { text: gettext('Add'), disabled: !canModify, handler: () => edit() }, + { + xtype: 'proxmoxButton', + text: gettext('Edit'), + disabled: true, + enableFn: (rec) => canEdit && !!rec.get('explicit'), + handler: (button, event, rec) => edit(rec), + }, + { + 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, event, rec) { + 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(), + }), + }, + '->', + gettext('Search') + ':', + ' ', + { + xtype: 'pveRecordSearchField', + emptyText: gettext('Name, WWID, Storage'), + searchFields: ['name', 'wwid', 'used-by-storage', 'multipath-storage'], + targetStore: lunStore, + }, + ], + }, + columns: [ + { + text: gettext('Name'), + dataIndex: 'name', + flex: 2, + renderer: (value, md, rec) => Ext.htmlEncode(value || rec.get('wwid')), + sorter: (a, b) => + (a.data.name || a.data.wwid).localeCompare(b.data.name || b.data.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'; + } + // a node in Unknown does not count for the state, it is listed after it + let unknown = nodes.filter(([, s]) => s === 'unknown').map(([n]) => n); + let suffix = + value !== 'unknown' && unknown.length + ? `, ${PVE.SANUtils.renderState('unknown')} (${Ext.htmlEncode(unknown.join(', '))})` + : ''; + 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 - unknown.length + ) { + return PVE.SANUtils.renderState(value) + suffix; + } + 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}${suffix}`; + } + return `${PVE.SANUtils.renderState(value)} (${names})${suffix}`; + }, + }, + { + 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, + sorter: (a, b) => + (a.data['used-by-storage'] ?? '').localeCompare( + b.data['used-by-storage'] ?? '', + ), + }, + { + 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.mon(lunStore, 'refresh', () => PVE.SANUtils.deselectHidden(me.down('#luns'))); + me.mon(me.rstore, 'load', () => + me + .down('gridcolumn[dataIndex=other-maps]') + .setHidden(!me.rstore.getRange().some((rec) => rec.get('other-maps'))), + ); + me.on('activate', () => me.rstore.startUpdate()); + me.on('deactivate', () => me.rstore.stopUpdate()); + me.on('destroy', () => { + nodeStore.destroy(); + lunStore.destroy(); + me.rstore.destroy(); + }); + }, +});