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 147EC1FF0E3 for ; Wed, 18 Nov 2026 21:33:33 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6B3DD21CAB; Wed, 18 Nov 2026 21:28:12 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v7 manager 40/43] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Date: Wed, 18 Nov 2026 21:26:23 +0100 Message-ID: <20261118202646.3017286-41-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118202646.3017286-1-t.lamprecht@proxmox.com> References: <20261118202646.3017286-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: 1795033613515 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.164 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: QYD25RR2YYRISACZE2JUACHXGSNV5CBS X-Message-ID-Hash: QYD25RR2YYRISACZE2JUACHXGSNV5CBS 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: Fibre Channel LUNs show up as block devices on the nodes, without a storage that connects to them, so Datacenter > Storage > Add has no dialog to start from. Add a Fibre Channel entry to the guided setup of the SAN view. The entry offers SCSI LUNs only. An NVMe/FC namespace uses the native multipath of the kernel and has no storage that connects it, so the cluster-wide status could not show its state on the nodes. The setup enables multipath for the LUN if needed, so its menu entry needs Sys.Modify as well. Then the setup creates the volume group on the name of the map under /dev/disk/by-id, through the node serving the web UI, and adds the shared LVM storage itself. The node disk API would add the storage for all nodes and without the snapshot setting. Before it changes anything, the setup checks that the storage ID is free, as it cannot create the volume group a second time. As the setup adds the storage, it waits for the volume group task on its own, not in a task window. Closing a task window would end the setup with a volume group and no storage. For the same reason, the setup cannot be closed until the wait is over. If the task state cannot be read for a while, the setup ends and says how to add the storage by hand, as the task may still succeed and must not be started again. No storage knows how many paths a node should have to a Fibre Channel LUN. So a multipath entry that the setup adds expects as many paths as the map has on the node serving the web UI. A node zoned to fewer fabrics, or one that lost a path, then shows the LUN as degraded. Nodes do not scan for a LUN that gets mapped to them after their login to the array, so the setup points to the rescan of the Fibre Channel hosts. Co-authored-by: Dietmar Maurer Signed-off-by: Dietmar Maurer Signed-off-by: Thomas Lamprecht --- www/manager6/Makefile | 1 + www/manager6/dc/SAN.js | 5 +- www/manager6/storage/wizard/FibreChannel.js | 187 ++++++++++++++++++++ www/manager6/storage/wizard/LunSelect.js | 20 +++ www/manager6/storage/wizard/Wizard.js | 131 +++++++++++++- www/manager6/window/SANLunState.js | 10 +- 6 files changed, 341 insertions(+), 13 deletions(-) create mode 100644 www/manager6/storage/wizard/FibreChannel.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 09a02a9c4..1644e1d41 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -390,6 +390,7 @@ JSSRC= \ storage/wizard/LunSelect.js \ storage/wizard/NodeIdentities.js \ storage/wizard/IScsi.js \ + storage/wizard/FibreChannel.js \ Workspace.js \ # end of JSSRC list diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js index 72cb96291..e9a5e5ccc 100644 --- a/www/manager6/dc/SAN.js +++ b/www/manager6/dc/SAN.js @@ -111,9 +111,10 @@ Ext.define('PVE.dc.SANView', { autoShow: true, apiCallDone: (success) => success && reload(), }); - let setupItem = (wizardType) => ({ + let setupItem = (wizardType, disabled) => ({ text: PVE.storage.wizard.subject(wizardType), iconCls: 'fa fa-fw fa-building', + disabled, handler: () => Ext.create('PVE.storage.wizard.SAN', { wizardType, @@ -125,7 +126,7 @@ Ext.define('PVE.dc.SANView', { { text: gettext('Guided Setup'), disabled: !canSetup, - menu: [setupItem('iscsi')], + menu: [setupItem('iscsi'), setupItem('fc', !canModify)], }, ]; me.items = [ diff --git a/www/manager6/storage/wizard/FibreChannel.js b/www/manager6/storage/wizard/FibreChannel.js new file mode 100644 index 000000000..c3b688337 --- /dev/null +++ b/www/manager6/storage/wizard/FibreChannel.js @@ -0,0 +1,187 @@ +PVE.storage.wizard.createFC = function (wizard, values, lun) { + let fail = (response) => wizard.showError(response.htmlStatus); + let create = function (row) { + if (wizard.destroyed) { + return; + } + // the request starts the task that waitForTask() then waits for, so keep the setup open + let keepOpen = () => false; + wizard.on('beforeclose', keepOpen); + Proxmox.Utils.API2Request({ + url: `/nodes/${Proxmox.NodeName}/disks/lvm`, + method: 'POST', + params: { name: values.vgname, device: row['by-id'] }, + waitMsgTarget: wizard, + callback: () => wizard.un('beforeclose', keepOpen), + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + let recovery = (text) => + Ext.htmlEncode(Ext.String.format(text, values.vgname, values.storage)); + let addStorage = () => + wizard.addLVMStorage(values, (res) => + wizard.stopWithError( + res.htmlStatus + + '
' + + recovery( + gettext( + 'Volume group "{0}" was created, but adding storage "{1}" failed. Add it under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.', + ), + ), + ), + ); + let lost = (status) => + wizard.stopWithError( + status + + '
' + + recovery( + gettext( + 'Could not read the task status. The volume group creation task may still be running. Check its log under Node > Task History. If it succeeds, add volume group "{0}" as storage "{1}" under Datacenter > Storage > Add > LVM with Shared enabled and the same nodes and snapshot setting as in the setup.', + ), + ), + ); + let message = gettext('Creating the volume group...'); + wizard.waitForTask(response.result.data, message, addStorage, lost); + }, + }); + }; + let hasMultipath = (row) => ['manual', 'storage', 'unmanaged'].includes(row.multipath); + // the volume group is created on the by-id path of the map, which names the WWID + let ready = (row) => hasMultipath(row) && !!row['by-id']; + // Fibre Channel has no storage that knows how many paths a node should have, so an entry the + // setup adds expects the paths of this node. A node with fewer paths then shows as degraded. + // The wizard remembers the entry it added, so that a retry still sets the expected paths before + // it creates the volume group. + let expectPaths = function (row) { + if (!(row['paths-total'] >= 2)) { + delete wizard.addedEntry; + create(row); + return; + } + Proxmox.Utils.API2Request({ + url: `/cluster/multipath/wwid/${encodeURIComponent(lun.wwid)}`, + method: 'PUT', + params: { 'paths-expected': row['paths-total'] }, + waitMsgTarget: wizard, + failure: fail, + success: () => { + delete wizard.addedEntry; + create(row); + }, + }); + }; + let waitForMap = function () { + if (wizard.destroyed) { + return; + } + let store = Ext.create('Proxmox.data.UpdateStore', { + storeid: 'san-wizard-map', + model: 'pve-san-lun', + interval: 3000, + proxy: { type: 'proxmox', url: `/api2/json/nodes/${Proxmox.NodeName}/scan/san-luns` }, + }); + let timer = Ext.defer(function () { + store.destroy(); + if (!wizard.destroyed) { + wizard.setLoading(false); + wizard.showError( + gettext( + 'The multipath map or its name under /dev/disk/by-id did not appear within 90 seconds. Check Node > SAN, then reload the LUN list.', + ), + ); + } + }, 90000); + wizard.on( + 'destroy', + () => { + clearTimeout(timer); + if (!store.destroyed) { + store.destroy(); + } + }, + null, + { single: true }, + ); + wizard.setLoading(gettext('Waiting for the multipath map...')); + store.on('load', function (s, records, success, operation) { + if (wizard.destroyed) { + return; + } + let row = records?.find((rec) => rec.get('wwid') === lun.wwid)?.data; + if (!success || (row && ready(row))) { + clearTimeout(timer); + store.destroy(); + wizard.setLoading(false); + if (success) { + wizard.down('#luns').down('grid').getSelection()[0].set(row); + if (wizard.addedEntry === lun.wwid) { + expectPaths(row); + } else { + create(row); + } + } else { + wizard.showError(Proxmox.Utils.getResponseErrorMessage(operation.getError())); + } + } + }); + store.startUpdate(); + }; + let setup = function () { + if (ready(lun)) { + if (wizard.addedEntry === lun.wwid) { + expectPaths(lun); + } else { + create(lun); + } + } else if ( + hasMultipath(lun) || + lun.multipath === 'pending' || + wizard.addedEntry === lun.wwid + ) { + waitForMap(); + } else { + let params = { wwid: lun.wwid }; + if (values.nodes) { + params.nodes = values.nodes; + } + Proxmox.Utils.API2Request({ + url: '/cluster/multipath/wwid', + method: 'POST', + params, + waitMsgTarget: wizard, + failure: fail, + success: () => { + wizard.addedEntry = lun.wwid; + waitForMap(); + }, + }); + } + }; + // The storage is added last. Its ID has to be free before anything is created: once the volume + // group exists, the setup cannot create it again. + Proxmox.Utils.API2Request({ + url: '/storage', + method: 'GET', + waitMsgTarget: wizard, + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + if (response.result.data.some((entry) => entry.storage === values.storage)) { + wizard.showError( + Ext.htmlEncode( + Ext.String.format( + gettext('Storage ID "{0}" is already in use. Choose another ID.'), + values.storage, + ), + ), + ); + return; + } + setup(); + }, + }); +}; diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js index e42779927..985131c00 100644 --- a/www/manager6/storage/wizard/LunSelect.js +++ b/www/manager6/storage/wizard/LunSelect.js @@ -23,6 +23,10 @@ Ext.define('PVE.storage.wizard.LunSelect', { let grid = me.down('grid'); me.rstore.stopUpdate(); let connection = wizard.connection; + if (!connection) { + me.rstore.startUpdate(); + return; + } // The scan names one target per LUN, also for a LUN reached through several. The content // listing has the LUNs of the connection, and a LUN that shows up later is listed once the // scan names the target of the connection for it. @@ -88,6 +92,15 @@ Ext.define('PVE.storage.wizard.LunSelect', { 'A LUN that is in use cannot be selected. A LUN with data that is no longer needed has to be wiped under Node > SAN first.', ), }, + ...(me.rescanNote + ? [ + { + xtype: 'component', + margin: '0 0 10 0', + html: `${Ext.htmlEncode(gettext('Note:'))} ${me.rescanNote}`, + }, + ] + : []), { xtype: 'grid', flex: 1, @@ -189,6 +202,13 @@ Ext.define('PVE.storage.wizard.LunSelect', { let search = me.down('pveRecordSearchField'); me.on('activate', function () { search.setTargetStore(me.store); + if (me.up('window').wizardType === 'fc') { + me.down('gridcolumn[dataIndex=iscsi-lun]').hide(); + me.store.addFilter({ + id: 'transport', + filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')), + }); + } me.reload(); }); // The setup can update the selected row after this step, which the search must not hide. diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js index 3b4d4b8eb..bfcc5a6cb 100644 --- a/www/manager6/storage/wizard/Wizard.js +++ b/www/manager6/storage/wizard/Wizard.js @@ -1,7 +1,10 @@ Ext.ns('PVE.storage.wizard'); PVE.storage.wizard.subject = (type) => - Ext.String.format(gettext('LVM on {0}'), PVE.Utils.format_storage_type(type)); + Ext.String.format( + gettext('LVM on {0}'), + type === 'fc' ? gettext('Fibre Channel') : PVE.Utils.format_storage_type(type), + ); PVE.storage.wizard.validateNodes = function () { let nodes = [].concat(this.getValue() || []).filter(Boolean); @@ -20,6 +23,11 @@ Ext.define('PVE.storage.wizard.SAN', { width: 1050, height: 620, + stopWithError: function (message) { + this.close(); + Ext.Msg.alert(gettext('Error'), message); + }, + showError: function (message) { if (this.destroyed) { return; @@ -28,6 +36,65 @@ Ext.define('PVE.storage.wizard.SAN', { Ext.Msg.alert(gettext('Error'), message); }, + // Waits for a task with the setup masked and continues with next() once it succeeded. A task + // window of its own could be closed while the task runs, which would end the setup there. The + // setup cannot be closed during the wait either, for example with the Escape key. + // If the state of the task cannot be read for some time, lost() gets the error: the task may + // still be running then, so the setup must not start it again. + waitForTask: function (upid, message, next, lost) { + let me = this; + let task = Proxmox.Utils.parse_task_upid(upid); + let failures = 0; + let keepOpen = () => false; + let done = function (error) { + if (me.destroyed) { + return; + } + me.un('beforeclose', keepOpen); + me.setLoading(false); + if (error === undefined) { + next(); + } else { + me.showError(error); + } + }; + let poll = function () { + if (me.destroyed) { + return; + } + Proxmox.Utils.API2Request({ + url: `/nodes/${task.node}/tasks/${encodeURIComponent(upid)}/status`, + method: 'GET', + failure: function (response) { + if (me.destroyed) { + return; + } + if (++failures < 5) { + Ext.defer(poll, 2000); + return; + } + me.un('beforeclose', keepOpen); + me.setLoading(false); + lost(response.htmlStatus); + }, + success: function (response) { + failures = 0; + let { status, exitstatus } = response.result.data; + if (status !== 'stopped') { + Ext.defer(poll, 1000); + return; + } + let result = Proxmox.Utils.parse_task_status(exitstatus); + let failed = result === 'error' || result === 'unknown'; + done(failed ? Ext.htmlEncode(exitstatus) : undefined); + }, + }); + }; + me.on('beforeclose', keepOpen); + me.setLoading(message); + poll(); + }, + volumeSettings: function () { let me = this; let value = (name) => me.down(`field[name=${name}]`).getValue(); @@ -35,7 +102,13 @@ Ext.define('PVE.storage.wizard.SAN', { storage: value('storage'), vgname: value('vgname'), 'snapshot-as-volume-chain': value('snapshot-as-volume-chain') ? 1 : 0, - nodes: me.connection.nodes, + nodes: + me.wizardType === 'fc' + ? [] + .concat(value('nodes') || []) + .filter(Boolean) + .join(',') + : me.connection.nodes, }; }, @@ -64,6 +137,7 @@ Ext.define('PVE.storage.wizard.SAN', { wwid, storage: values.storage, nodes: params.nodes, + fc: me.wizardType === 'fc', autoShow: true, }); }, @@ -71,11 +145,18 @@ Ext.define('PVE.storage.wizard.SAN', { }, multipathSummary: function (lun) { + let me = this; // an explicit entry takes precedence, also for a LUN of the connection storage if (lun.multipath === 'manual') { return PVE.SANUtils.multipathText('manual'); } - return PVE.SANUtils.multipathText('storage', this.connection.storage); + if (me.connection) { + return PVE.SANUtils.multipathText('storage', me.connection.storage); + } + // the Fibre Channel setup adds an entry for a LUN without multipath + return lun.multipath === 'none' + ? gettext('Explicit entry, added by this setup') + : PVE.SANUtils.multipathText(lun.multipath, lun['multipath-storage']); }, updateSummary: function () { @@ -83,7 +164,6 @@ Ext.define('PVE.storage.wizard.SAN', { let values = me.volumeSettings(); let lun = me.down('#luns').getSelection(); let rows = [ - [gettext('Connection Storage'), me.connection.storage], [gettext('Storage ID'), values.storage], [gettext('Volume Group'), values.vgname], ['WWID', lun.wwid], @@ -95,6 +175,9 @@ Ext.define('PVE.storage.wizard.SAN', { Proxmox.Utils.format_boolean(values['snapshot-as-volume-chain']), ], ]; + if (me.connection) { + rows.unshift([gettext('Connection Storage'), me.connection.storage]); + } me.down('#summary') .getStore() .setData(rows.map(([key, value]) => ({ key, value }))); @@ -105,11 +188,19 @@ Ext.define('PVE.storage.wizard.SAN', { let values = me.volumeSettings(); let lun = me.down('#luns').getSelection(); me.down('#submit').disable(); - PVE.storage.wizard.createIScsiLVM(me, values, lun); + if (me.wizardType === 'fc') { + PVE.storage.wizard.createFC(me, values, lun); + } else { + PVE.storage.wizard.createIScsiLVM(me, values, lun); + } }, initComponent: function () { let me = this; + if (!['iscsi', 'fc'].includes(me.wizardType)) { + throw 'no SAN storage type specified'; + } + let iscsi = me.wizardType === 'iscsi'; me.subject = PVE.storage.wizard.subject(me.wizardType); me.title = Proxmox.Utils.dialog_title(me.subject, true, true); let common = PVE.panel.StorageBase.commonFields(true); @@ -129,13 +220,35 @@ Ext.define('PVE.storage.wizard.SAN', { PVE.panel.StorageBase.volumeChainField(true, 'lvm'), ], }; + if (!iscsi) { + settings.advancedItems = [ + { ...common.nodes, validator: PVE.storage.wizard.validateNodes }, + ]; + } me.items = [ - { xtype: 'pveStorageWizardIScsiTarget', title: gettext('Target'), itemId: 'target' }, + ...(iscsi + ? [ + { + xtype: 'pveStorageWizardIScsiTarget', + title: gettext('Target'), + itemId: 'target', + }, + ] + : []), { xtype: 'pveStorageWizardLunSelect', title: 'LUN', itemId: 'luns', onlineHelp: 'storage_multipath', + // the nodes only see a newly mapped Fibre Channel LUN after a rescan + rescanNote: iscsi + ? undefined + : Ext.String.format( + gettext( + 'After mapping a new LUN on the array, rescan the Fibre Channel hosts of each node (documentation).', + ), + Ext.htmlEncode(Proxmox.Utils.get_help_link('storage_multipath')), + ), }, settings, { @@ -170,14 +283,16 @@ Ext.define('PVE.storage.wizard.SAN', { me.callParent(); let tabs = me.down('#wizcontent'); tabs.on('tabchange', function (tp, tab) { - if (tab === me.down('#luns')) { + if (iscsi && tab === me.down('#luns')) { me.down('#back').disable(); } me.down('#submit').setText( tab === me.down('#target') ? gettext('Next') : gettext('Finish'), ); }); - me.down('#submit').setText(gettext('Next')); + if (iscsi) { + me.down('#submit').setText(gettext('Next')); + } me.on('destroy', () => me.reloadCallback?.()); }, }); diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js index 6d5221329..6215f8e57 100644 --- a/www/manager6/window/SANLunState.js +++ b/www/manager6/window/SANLunState.js @@ -55,9 +55,13 @@ Ext.define('PVE.window.SANLunState', { margin: '0 0 10 0', html: Ext.htmlEncode( Ext.String.format( - gettext( - 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.', - ), + me.fc + ? gettext( + 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array and rescan its Fibre Channel hosts.', + ) + : gettext( + 'Storage "{0}" was added. Guests on this storage cannot run on a node that stays on "Missing": check its access to the LUN on the array.', + ), me.storage, ), ),