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 9B7E21FF0B7 for ; Fri, 13 Nov 2026 04:18:55 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D752321BF8; Fri, 13 Nov 2026 04:05:17 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v4 manager 35/36] ui: dc: san: add a guided setup for shared LVM on Fibre Channel Date: Fri, 13 Nov 2026 04:00:53 +0100 Message-ID: <20261113030146.1559030-36-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: 1794538915907 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.237 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: D4VQWEWT4UGSZUKYRBRMEY6H5JDHQ7RE X-Message-ID-Hash: D4VQWEWT4UGSZUKYRBRMEY6H5JDHQ7RE 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: select the LUN, name the volume group and storage, confirm. The setup enables multipath for the LUN if needed and waits for its map, then creates the volume group through the node serving the web UI and adds the shared LVM storage. It adds the storage itself instead of letting the node disk API do so, as that would add it for all nodes and without the snapshot setting, to be changed afterwards. A Fibre Channel LUN has no storage that knows how many paths a node should have. So an entry the setup adds expects as many paths as the map has on that node, and a node zoned to fewer fabrics or one that lost a path shows the LUN as degraded. A LUN with a volume group cannot be selected again, so the setup checks that the storage ID is free before it changes anything. Nodes do not scan for a LUN that is mapped to them after their login to the array, so the LUN step names the rescan of the Fibre Channel hosts, which the documentation describes, and so does the closing window for a node that stays missing. 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 | 162 ++++++++++++++++++++ www/manager6/storage/wizard/LunSelect.js | 25 ++- www/manager6/storage/wizard/Wizard.js | 90 ++++++++++- www/manager6/window/SANLunState.js | 10 +- 6 files changed, 279 insertions(+), 14 deletions(-) create mode 100644 www/manager6/storage/wizard/FibreChannel.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index c7cefeacc..ebdc3f802 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -389,6 +389,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 fa60a1e6f..6b32926c7 100644 --- a/www/manager6/dc/SAN.js +++ b/www/manager6/dc/SAN.js @@ -105,9 +105,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, @@ -119,7 +120,7 @@ Ext.define('PVE.dc.SANView', { { text: gettext('Add Storage'), disabled: !allCaps.storage['Datastore.Allocate'], - 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..950add8e5 --- /dev/null +++ b/www/manager6/storage/wizard/FibreChannel.js @@ -0,0 +1,162 @@ +PVE.storage.wizard.createFC = function (wizard, values, lun) { + let fail = (response) => wizard.showError(response.htmlStatus); + let create = function (row) { + if (wizard.destroyed) { + return; + } + Proxmox.Utils.API2Request({ + url: `/nodes/${Proxmox.NodeName}/disks/lvm`, + method: 'POST', + params: { name: values.vgname, device: row['by-id'] || row.devpath }, + waitMsgTarget: wizard, + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + wizard.waitForTask(response.result.data, () => + 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 hasMultipath = (row) => + ['manual', 'storage', 'unmanaged', 'native'].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 completes the count first. + 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, as the LUN + // cannot be selected again once it has a volume group. + 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 1156a4eee..a34b95d29 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 }, ]); @@ -67,6 +71,15 @@ Ext.define('PVE.storage.wizard.LunSelect', { 'A LUN used by a storage cannot be selected. A LUN with other data 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, @@ -148,7 +161,17 @@ 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', 'nvme-fc'].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 3062cfa99..9d4e6a256 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,24 @@ Ext.define('PVE.storage.wizard.SAN', { Ext.Msg.alert(gettext('Error'), message); }, + waitForTask: function (upid, next) { + let me = this; + Ext.create('Proxmox.window.TaskProgress', { + upid, + autoShow: true, + taskDone: function (success) { + if (me.destroyed) { + return; + } + if (success) { + next(); + } else { + me.down('#submit').enable(); + } + }, + }); + }, + volumeSettings: function () { let me = this; let value = (name) => me.down(`field[name=${name}]`).getValue(); @@ -35,7 +61,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, }; }, @@ -59,6 +91,7 @@ Ext.define('PVE.storage.wizard.SAN', { Ext.create('PVE.window.SANLunState', { wwid, storage: values.storage, + fc: me.wizardType === 'fc', autoShow: true, }); }, @@ -66,11 +99,18 @@ Ext.define('PVE.storage.wizard.SAN', { }, multipathSummary: function (lun) { + let me = this; // an explicit entry configures the map, also of 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 () { @@ -78,7 +118,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], @@ -90,6 +129,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 }))); @@ -100,11 +142,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); @@ -126,13 +176,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, { @@ -167,14 +239,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, ), ),