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 E2C071FF0C0 for ; Wed, 18 Nov 2026 07:59:05 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2044521B75; Wed, 18 Nov 2026 07:54:18 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v6 manager 39/42] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Date: Wed, 18 Nov 2026 07:52:56 +0100 Message-ID: <20261118065302.3033937-40-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: 1794984789395 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.177 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: TU35BUKAYCPV4NLGNRFA2UYOSOST2HOH X-Message-ID-Hash: TU35BUKAYCPV4NLGNRFA2UYOSOST2HOH 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 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 | 175 ++++++++++++++++++++ www/manager6/storage/wizard/LunSelect.js | 23 ++- www/manager6/storage/wizard/Wizard.js | 131 ++++++++++++++- www/manager6/window/SANLunState.js | 10 +- 6 files changed, 331 insertions(+), 14 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 9255d2f6a..165411314 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..200e7d83a --- /dev/null +++ b/www/manager6/storage/wizard/FibreChannel.js @@ -0,0 +1,175 @@ +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'] || row.devpath }, + waitMsgTarget: wizard, + callback: () => wizard.un('beforeclose', keepOpen), + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + let addStorage = () => + wizard.addLVMStorage(values, (res) => + wizard.stopWithError( + res.htmlStatus + + '
' + + gettext( + 'The volume group was created, but adding the storage failed. Add it under Datacenter > Storage > Add > LVM with Shared enabled.', + ), + ), + ); + let lost = (status) => + wizard.stopWithError( + status + + '
' + + 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 the volume group under Datacenter > Storage > Add > LVM with Shared enabled.', + ), + ); + let message = gettext('Creating the volume group...'); + wizard.waitForTask(response.result.data, message, addStorage, lost); + }, + }); + }; + let hasMultipath = (row) => ['manual', 'storage', 'unmanaged'].includes(row.multipath); + // 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 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 && hasMultipath(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 (hasMultipath(lun)) { + if (wizard.addedEntry === lun.wwid) { + expectPaths(lun); + } else { + create(lun); + } + } else if (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 dbf789f4e..0a6d5c4a4 100644 --- a/www/manager6/storage/wizard/LunSelect.js +++ b/www/manager6/storage/wizard/LunSelect.js @@ -22,6 +22,10 @@ Ext.define('PVE.storage.wizard.LunSelect', { let wizard = me.up('window'); let grid = me.down('grid'); me.rstore.stopUpdate(); + if (!wizard.connection) { + me.rstore.startUpdate(); + return; + } me.store.setFilters([ { property: 'iscsi-target', value: wizard.connection.target, exactMatch: true }, ]); @@ -68,6 +72,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, @@ -146,7 +159,15 @@ Ext.define('PVE.storage.wizard.LunSelect', { me.callParent(); Proxmox.Utils.monStoreErrors(me.down('grid'), me.rstore); me.mon(me.rstore, 'load', updateSelection); - me.on('activate', () => me.reload()); + me.on('activate', function () { + if (me.up('window').wizardType === 'fc') { + me.down('gridcolumn[dataIndex=iscsi-lun]').hide(); + me.store.setFilters([ + { filterFn: (rec) => ['fc', 'fcoe'].includes(rec.get('transport')) }, + ]); + } + me.reload(); + }); me.on('deactivate', () => me.rstore.stopUpdate()); me.on('destroy', () => { me.store.destroy(); diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js index 1f3975b75..2affda528 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, }; }, @@ -63,6 +136,7 @@ Ext.define('PVE.storage.wizard.SAN', { Ext.create('PVE.window.SANLunState', { wwid, storage: values.storage, + fc: me.wizardType === 'fc', autoShow: true, }); }, @@ -70,11 +144,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 () { @@ -82,7 +163,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], @@ -94,6 +174,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 }))); @@ -104,11 +187,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); @@ -130,13 +221,35 @@ Ext.define('PVE.storage.wizard.SAN', { snapshots.hint, ], }; + 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, { @@ -171,14 +284,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 154836f3b..a0a6d514d 100644 --- a/www/manager6/window/SANLunState.js +++ b/www/manager6/window/SANLunState.js @@ -51,9 +51,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, ), ),