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 3CDA71FF0C0 for ; Wed, 18 Nov 2026 08:00:19 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id A20B321C5C; Wed, 18 Nov 2026 07:54:21 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v6 manager 38/42] ui: dc: san: add a guided setup for shared LVM on iSCSI Date: Wed, 18 Nov 2026 07:52:55 +0100 Message-ID: <20261118065302.3033937-39-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: 1794984789331 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: MRJYDNDIGXXOJQFDIBEV6EDNUDLQLFKS X-Message-ID-Hash: MRJYDNDIGXXOJQFDIBEV6EDNUDLQLFKS 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: Shared LVM on an iSCSI LUN needs an iSCSI storage with multipath, the right LUN as base volume and an LVM storage on top, in that order. Add a guided setup for it to the SAN view: connect to the target, with the initiator names of all nodes at hand for the access rules of the array, select a LUN, name the volume group and storage, and confirm. The setup starts from the SAN view and not from Datacenter > Storage > Add, as it creates a volume group and up to two storages, while an entry of the Add menu attaches one storage. Its menu is named Guided Setup, as in the documentation, so that it is not taken for an Add menu or button. Continuing from the target step creates or reuses the connection storage before the confirm step, so the target step says so. The menu needs Datastore.Allocate. It also needs Datastore.Audit or Datastore.AllocateSpace, as the setup reads the storage list and the LUNs of the connection storage. The LUN list comes from the node serving the web UI, and a LUN that a storage uses cannot be selected. For a shared storage it matters whether the other nodes see the LUN as well. So the setup ends with the state of the LUN on each node of the storage, from the cluster-wide status. Nodes set up a new LUN with their next status updates, so for the first minute a node without the LUN shows as pending and not as missing. Co-authored-by: Dietmar Maurer Signed-off-by: Dietmar Maurer Signed-off-by: Thomas Lamprecht --- www/manager6/Makefile | 5 + www/manager6/dc/SAN.js | 25 +- www/manager6/storage/wizard/IScsi.js | 274 ++++++++++++++++++ www/manager6/storage/wizard/LunSelect.js | 156 ++++++++++ www/manager6/storage/wizard/NodeIdentities.js | 83 ++++++ www/manager6/storage/wizard/Wizard.js | 184 ++++++++++++ www/manager6/window/SANLunState.js | 111 +++++++ 7 files changed, 837 insertions(+), 1 deletion(-) create mode 100644 www/manager6/storage/wizard/IScsi.js create mode 100644 www/manager6/storage/wizard/LunSelect.js create mode 100644 www/manager6/storage/wizard/NodeIdentities.js create mode 100644 www/manager6/storage/wizard/Wizard.js create mode 100644 www/manager6/window/SANLunState.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 4a6c8af72..09a02a9c4 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -137,6 +137,7 @@ JSSRC= \ window/Restore.js \ window/SafeDestroyGuest.js \ window/SafeDestroyStorage.js \ + window/SANLunState.js \ window/SANLunWipe.js \ window/Settings.js \ window/Snapshot.js \ @@ -385,6 +386,10 @@ JSSRC= \ storage/ZFSEdit.js \ storage/ZFSPoolEdit.js \ storage/ESXIEdit.js \ + storage/wizard/Wizard.js \ + storage/wizard/LunSelect.js \ + storage/wizard/NodeIdentities.js \ + storage/wizard/IScsi.js \ Workspace.js \ # end of JSSRC list diff --git a/www/manager6/dc/SAN.js b/www/manager6/dc/SAN.js index e8d3614f2..9255d2f6a 100644 --- a/www/manager6/dc/SAN.js +++ b/www/manager6/dc/SAN.js @@ -50,9 +50,15 @@ Ext.define('PVE.dc.SANView', { initComponent: function () { let me = this; - let caps = Ext.state.Manager.get('GuiCap').dc; + let allCaps = Ext.state.Manager.get('GuiCap'); + let caps = allCaps.dc; let canModify = !!caps['Sys.Modify']; let canEdit = canModify && !!caps['Sys.Audit']; + // the setups also read the storage list and the LUNs of the connection storage + let storageCaps = allCaps.storage; + let canSetup = + !!storageCaps['Datastore.Allocate'] && + !!(storageCaps['Datastore.Audit'] || storageCaps['Datastore.AllocateSpace']); me.rstore = Ext.create('Proxmox.data.UpdateStore', { storeid: 'dc-san-status', model: 'pve-san-status', @@ -105,6 +111,23 @@ Ext.define('PVE.dc.SANView', { autoShow: true, apiCallDone: (success) => success && reload(), }); + let setupItem = (wizardType) => ({ + text: PVE.storage.wizard.subject(wizardType), + iconCls: 'fa fa-fw fa-building', + handler: () => + Ext.create('PVE.storage.wizard.SAN', { + wizardType, + autoShow: true, + reloadCallback: reload, + }), + }); + me.tbar = [ + { + text: gettext('Guided Setup'), + disabled: !canSetup, + menu: [setupItem('iscsi')], + }, + ]; me.items = [ { xtype: 'grid', diff --git a/www/manager6/storage/wizard/IScsi.js b/www/manager6/storage/wizard/IScsi.js new file mode 100644 index 000000000..94d914092 --- /dev/null +++ b/www/manager6/storage/wizard/IScsi.js @@ -0,0 +1,274 @@ +Ext.define('PVE.storage.wizard.IScsiTarget', { + extend: 'Proxmox.panel.InputPanel', + xtype: 'pveStorageWizardIScsiTarget', + onlineHelp: 'storage_open_iscsi', + + updateConnectionField: function () { + let me = this; + let target = me.down('field[name=target]').getValue(); + let storage = me.storages?.find( + (entry) => entry.type === 'iscsi' && entry.target === target, + ); + let field = me.down('field[name=connection]'); + if (storage) { + field.setValue(storage.storage); + } else if (field.readOnly) { + field.setValue(''); + } + field.setReadOnly(!!storage); + }, + + onSubmit: function () { + let me = this; + let wizard = me.up('window'); + let values = me.getValues(); + let params = { + type: 'iscsi', + storage: values.connection, + portal: values.portal, + target: values.target, + content: 'none', + 'managed-multipath': 1, + }; + let nodes = [] + .concat(values.nodes || []) + .filter(Boolean) + .join(','); + if (nodes) { + params.nodes = nodes; + } + let connected = function (connection) { + if (wizard.destroyed) { + return; + } + wizard.connection = connection; + // the step does not come back, the cluster status of its initiator names is not needed + me.down('pveStorageWizardNodeIdentities').rstore.stopUpdate(); + let tabs = wizard.down('#wizcontent'); + wizard.down('#luns').enable(); + tabs.setActiveTab(wizard.down('#luns')); + me.disable(); + }; + let fail = (response) => wizard.showError(response.htmlStatus); + Proxmox.Utils.API2Request({ + url: '/storage', + method: 'GET', + waitMsgTarget: wizard, + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + me.storages = response.result.data; + me.updateConnectionField(); + let users = me.storages.filter((entry) => entry.target === values.target); + if (users.length) { + let base = users[0]; + if ( + users.length !== 1 || + base.type !== 'iscsi' || + `${base.content ?? ''}` !== 'none' + ) { + wizard.showError( + gettext( + 'This target is already used by another storage. Check Datacenter > Storage.', + ), + ); + return; + } + if (base.disable) { + wizard.showError( + Ext.htmlEncode( + Ext.String.format( + gettext( + 'Storage "{0}" connects to this target, but it is disabled. Enable that storage first.', + ), + base.storage, + ), + ), + ); + return; + } + let baseNodes = base.nodes ? base.nodes.split(',') : []; + if (baseNodes.length && !baseNodes.includes(Proxmox.NodeName)) { + wizard.showError( + Ext.htmlEncode( + Ext.String.format( + gettext( + 'Connection storage "{0}" is not available on node "{1}". Open the web UI on one of its nodes.', + ), + base.storage, + Proxmox.NodeName, + ), + ), + ); + return; + } + let selectedNodes = nodes ? nodes.split(',') : baseNodes; + if ( + baseNodes.length && + selectedNodes.some((node) => !baseNodes.includes(node)) + ) { + wizard.showError( + gettext( + 'The connection storage is not available on all selected nodes.', + ), + ); + return; + } + let connection = { + storage: base.storage, + target: base.target, + nodes: selectedNodes.join(','), + }; + if (!base['managed-multipath']) { + wizard.showError( + Ext.htmlEncode( + Ext.String.format( + gettext( + 'Enable Multipath in the edit dialog of storage "{0}" before using it here.', + ), + base.storage, + ), + ), + ); + return; + } + connected(connection); + return; + } + Proxmox.Utils.API2Request({ + url: '/storage', + method: 'POST', + params, + waitMsgTarget: wizard, + failure: fail, + success: () => + connected({ storage: params.storage, target: params.target, nodes }), + }); + }, + }); + }, + + initComponent: function () { + let me = this; + let common = PVE.panel.StorageBase.commonFields(true); + // wide enough for the longest label of the step + let labelWidth = 150; + me.items = [ + { + xtype: 'textfield', + name: 'portal', + fieldLabel: gettext('Portal'), + labelWidth, + allowBlank: false, + listeners: { + change: { + buffer: 500, + fn: function (field, value) { + let target = me.down('field[name=target]'); + target.setDisabled(!value); + target.setValue(''); + target.setPortal(value); + }, + }, + }, + }, + { + xtype: 'pveIScsiScan', + name: 'target', + fieldLabel: gettext('Target'), + labelWidth, + disabled: true, + showNodeSelector: false, + nodename: Proxmox.NodeName, + listeners: { change: () => me.updateConnectionField() }, + listConfig: { + width: 650, + emptyText: PVE.Utils.renderNotFound(gettext('iSCSI Target')), + columns: [ + { + text: gettext('Target'), + dataIndex: 'target', + flex: 1, + renderer: Ext.htmlEncode, + }, + { + text: gettext('Portals'), + dataIndex: 'portal', + width: 220, + renderer: Ext.htmlEncode, + }, + ], + }, + }, + { + ...common.id, + name: 'connection', + fieldLabel: gettext('Connection Storage'), + labelWidth, + }, + { + xtype: 'component', + margin: '0 0 10 0', + html: `${Ext.htmlEncode(gettext('Note:'))} ${Ext.htmlEncode( + gettext( + 'Next creates or reuses the connection storage before you select a LUN.', + ), + )}`, + }, + { xtype: 'pveStorageWizardNodeIdentities' }, + ]; + me.advancedItems = [ + { ...common.nodes, labelWidth, validator: PVE.storage.wizard.validateNodes }, + ]; + me.callParent(); + me.on('afterrender', () => + Proxmox.Utils.API2Request({ + url: '/storage', + method: 'GET', + waitMsgTarget: me, + failure: function (response) { + if (!me.destroyed) { + me.up('window').showError(response.htmlStatus); + } + }, + success: function (response) { + if (!me.destroyed) { + me.storages = response.result.data; + me.updateConnectionField(); + } + }, + }), + ); + }, +}); + +PVE.storage.wizard.createIScsiLVM = function (wizard, values, lun) { + let connection = wizard.connection; + let fail = (response) => wizard.showError(response.htmlStatus); + Proxmox.Utils.API2Request({ + url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(connection.storage)}/content`, + method: 'GET', + params: { content: 'images' }, + waitMsgTarget: wizard, + failure: fail, + success: function (response) { + if (wizard.destroyed) { + return; + } + let volume = response.result.data.find((entry) => + entry.volid.endsWith(`.dm-uuid-mpath-${lun.wwid}`), + ); + if (!volume) { + wizard.showError( + gettext( + 'The selected LUN has no multipath volume yet. Check Node > SAN, then retry.', + ), + ); + return; + } + wizard.addLVMStorage({ ...values, base: volume.volid }, fail); + }, + }); +}; diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js new file mode 100644 index 000000000..dbf789f4e --- /dev/null +++ b/www/manager6/storage/wizard/LunSelect.js @@ -0,0 +1,156 @@ +Ext.define('PVE.storage.wizard.LunSelect', { + extend: 'Ext.panel.Panel', + xtype: 'pveStorageWizardLunSelect', + layout: { type: 'vbox', align: 'stretch' }, + + // as an input panel does, so that the wizard shows its help button for this step + listeners: { + activate: function () { + Ext.GlobalEvents.fireEvent('proxmoxShowHelp', this.onlineHelp); + }, + deactivate: function () { + Ext.GlobalEvents.fireEvent('proxmoxHideHelp', this.onlineHelp); + }, + }, + + getSelection: function () { + return this.down('grid').getSelection()[0]?.data; + }, + + reload: function () { + let me = this; + let wizard = me.up('window'); + let grid = me.down('grid'); + me.rstore.stopUpdate(); + me.store.setFilters([ + { property: 'iscsi-target', value: wizard.connection.target, exactMatch: true }, + ]); + Proxmox.Utils.API2Request({ + url: `/nodes/${Proxmox.NodeName}/storage/${encodeURIComponent(wizard.connection.storage)}/content`, + method: 'GET', + waitMsgTarget: grid, + failure: (response) => Ext.Msg.alert(gettext('Error'), response.htmlStatus), + callback: function () { + if (!me.destroyed && wizard.down('#wizcontent').getActiveTab() === me) { + me.rstore.startUpdate(); + } + }, + }); + }, + + initComponent: function () { + let me = this; + me.rstore = Ext.create('Proxmox.data.UpdateStore', { + storeid: 'san-wizard-luns', + model: 'pve-san-lun', + interval: 3000, + proxy: { type: 'proxmox', url: `/api2/json/nodes/${Proxmox.NodeName}/scan/san-luns` }, + }); + me.store = Ext.create('Proxmox.data.DiffStore', { rstore: me.rstore }); + let inUse = (row) => row['used-by-storage']; + let updateSelection = function () { + let row = me.getSelection(); + me.down('#selection').setValue(row && !inUse(row) ? row.wwid : ''); + }; + me.items = [ + { + xtype: 'textfield', + itemId: 'selection', + hidden: true, + allowBlank: false, + submitValue: false, + }, + { + xtype: 'component', + cls: 'pmx-hint', + margin: '0 0 10 0', + html: gettext( + '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.', + ), + }, + { + xtype: 'grid', + flex: 1, + store: me.store, + emptyText: gettext('No LUNs found. Check connections and array access.'), + viewConfig: { + enableTextSelection: true, + getRowClass: (rec) => (inUse(rec.data) ? 'x-item-disabled' : ''), + }, + listeners: { + beforeselect: (sm, rec) => !inUse(rec.data), + selectionchange: updateSelection, + }, + columns: [ + { + text: gettext('Name'), + dataIndex: 'name', + flex: 1, + minWidth: 260, + renderer: (value, md, rec) => Ext.htmlEncode(value || rec.get('wwid')), + }, + { text: 'LUN', dataIndex: 'iscsi-lun', width: 60 }, + { + text: gettext('Model'), + dataIndex: 'model', + width: 160, + renderer: (value, md, rec) => + Ext.htmlEncode([rec.get('vendor'), value].filter(Boolean).join(' ')), + }, + { + text: gettext('State'), + dataIndex: 'state', + width: 140, + renderer: PVE.SANUtils.renderLunState, + }, + { + text: gettext('Multipath'), + dataIndex: 'multipath', + width: 170, + renderer: PVE.SANUtils.renderSanLunMultipath, + }, + { + text: gettext('Used By'), + dataIndex: 'usage', + width: 130, + renderer: PVE.SANUtils.renderSanLunUsage, + }, + { + text: gettext('Size'), + dataIndex: 'size', + width: 100, + renderer: Proxmox.Utils.render_size, + }, + { + text: gettext('Device'), + dataIndex: 'devpath', + width: 180, + hidden: true, + renderer: Ext.htmlEncode, + }, + ], + tbar: [ + { + text: gettext('Reload'), + iconCls: 'fa fa-refresh', + handler: () => me.reload(), + }, + '->', + { + xtype: 'tbtext', + html: Ext.htmlEncode(`${gettext('Scan node')}: ${Proxmox.NodeName}`), + }, + ], + }, + ]; + me.callParent(); + Proxmox.Utils.monStoreErrors(me.down('grid'), me.rstore); + me.mon(me.rstore, 'load', updateSelection); + me.on('activate', () => me.reload()); + me.on('deactivate', () => me.rstore.stopUpdate()); + me.on('destroy', () => { + me.store.destroy(); + me.rstore.destroy(); + }); + }, +}); diff --git a/www/manager6/storage/wizard/NodeIdentities.js b/www/manager6/storage/wizard/NodeIdentities.js new file mode 100644 index 000000000..9c7ab8cce --- /dev/null +++ b/www/manager6/storage/wizard/NodeIdentities.js @@ -0,0 +1,83 @@ +Ext.define('pve-san-node-identity', { + extend: 'Ext.data.Model', + idProperty: 'node', + fields: ['node', 'state', 'iscsi-initiator-name'], +}); + +Ext.define('PVE.storage.wizard.NodeIdentities', { + extend: 'Ext.grid.Panel', + xtype: 'pveStorageWizardNodeIdentities', + height: 220, + disableSelection: true, + viewConfig: { enableTextSelection: true }, + columns: [ + { text: gettext('Node'), dataIndex: 'node', width: 100, renderer: Ext.htmlEncode }, + { + text: gettext('State'), + dataIndex: 'state', + width: 175, + renderer: PVE.SANUtils.renderState, + }, + { + text: gettext('Initiator Name'), + dataIndex: 'iscsi-initiator-name', + flex: 1, + renderer: Ext.htmlEncode, + }, + ], + + initComponent: function () { + let me = this; + me.rstore = Ext.create('Proxmox.data.UpdateStore', { + storeid: 'san-wizard-identities', + model: 'pve-san-node-identity', + interval: 5000, + proxy: { + type: 'proxmox', + url: '/api2/json/cluster/multipath/status', + reader: { + type: 'json', + rootProperty: 'data', + transform: (raw) => ({ + ...raw, + data: Object.entries(raw.data.nodes).map(([node, report]) => ({ + ...report, + node, + })), + }), + }, + }, + }); + me.store = Ext.create('Proxmox.data.DiffStore', { + rstore: me.rstore, + sorters: ['node'], + sortAfterUpdate: true, + }); + me.tbar = [ + { + xtype: 'tbtext', + text: gettext('Allow these initiator names on the target.'), + }, + '->', + { + text: gettext('Copy Initiator Names'), + iconCls: 'fa fa-clipboard', + handler: () => + PVE.Utils.copyToClipboard( + me.store + .getRange() + .map((rec) => rec.get('iscsi-initiator-name')) + .filter(Boolean) + .join('\n'), + ), + }, + ]; + me.callParent(); + Proxmox.Utils.monStoreErrors(me, me.rstore); + me.on('afterrender', () => me.rstore.startUpdate()); + me.on('destroy', () => { + me.store.destroy(); + me.rstore.destroy(); + }); + }, +}); diff --git a/www/manager6/storage/wizard/Wizard.js b/www/manager6/storage/wizard/Wizard.js new file mode 100644 index 000000000..1f3975b75 --- /dev/null +++ b/www/manager6/storage/wizard/Wizard.js @@ -0,0 +1,184 @@ +Ext.ns('PVE.storage.wizard'); + +PVE.storage.wizard.subject = (type) => + Ext.String.format(gettext('LVM on {0}'), PVE.Utils.format_storage_type(type)); + +PVE.storage.wizard.validateNodes = function () { + let nodes = [].concat(this.getValue() || []).filter(Boolean); + return ( + !nodes.length || + nodes.includes(Proxmox.NodeName) || + Ext.String.format( + gettext('Must include node "{0}", which sets up the volume group.'), + Proxmox.NodeName, + ) + ); +}; + +Ext.define('PVE.storage.wizard.SAN', { + extend: 'PVE.window.Wizard', + width: 1050, + height: 620, + + showError: function (message) { + if (this.destroyed) { + return; + } + this.down('#submit').enable(); + Ext.Msg.alert(gettext('Error'), message); + }, + + volumeSettings: function () { + let me = this; + let value = (name) => me.down(`field[name=${name}]`).getValue(); + return { + storage: value('storage'), + vgname: value('vgname'), + 'snapshot-as-volume-chain': value('snapshot-as-volume-chain') ? 1 : 0, + nodes: me.connection.nodes, + }; + }, + + // Adds the LVM storage with the volume settings as the last request of a setup. Only the node + // serving the web UI looked at the LUN, so show its state on the other nodes afterwards. + addLVMStorage: function (values, failure) { + let me = this; + let params = { type: 'lvm', shared: 1, content: 'images,rootdir', ...values }; + if (!params.nodes) { + delete params.nodes; + } + Proxmox.Utils.API2Request({ + url: '/storage', + method: 'POST', + params, + waitMsgTarget: me, + failure, + success: function () { + // the storage is added, also if the setup got closed in the meantime + if (me.destroyed) { + return; + } + let wwid = me.down('#luns').getSelection().wwid; + me.close(); + Ext.create('PVE.window.SANLunState', { + wwid, + storage: values.storage, + autoShow: true, + }); + }, + }); + }, + + multipathSummary: function (lun) { + // 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); + }, + + updateSummary: function () { + let me = this; + 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], + [gettext('Multipath'), me.multipathSummary(lun)], + [gettext('Size'), Proxmox.Utils.format_size(lun.size)], + [gettext('Nodes'), values.nodes || gettext('All (No restrictions)')], + [ + gettext('Allow Snapshots as Volume-Chain'), + Proxmox.Utils.format_boolean(values['snapshot-as-volume-chain']), + ], + ]; + me.down('#summary') + .getStore() + .setData(rows.map(([key, value]) => ({ key, value }))); + }, + + finish: function () { + let me = this; + let values = me.volumeSettings(); + let lun = me.down('#luns').getSelection(); + me.down('#submit').disable(); + PVE.storage.wizard.createIScsiLVM(me, values, lun); + }, + + initComponent: function () { + let me = this; + 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); + let snapshots = PVE.panel.StorageBase.volumeChainFields(true, 'lvm'); + let settings = { + xtype: 'inputpanel', + title: gettext('Volume Group'), + onlineHelp: 'storage_multipath', + items: [ + { ...common.id, fieldLabel: gettext('Storage ID') }, + { + xtype: 'textfield', + name: 'vgname', + fieldLabel: gettext('Volume Group'), + allowBlank: false, + vtype: 'StorageId', + }, + snapshots.checkbox, + snapshots.hint, + ], + }; + me.items = [ + { xtype: 'pveStorageWizardIScsiTarget', title: gettext('Target'), itemId: 'target' }, + { + xtype: 'pveStorageWizardLunSelect', + title: 'LUN', + itemId: 'luns', + onlineHelp: 'storage_multipath', + }, + settings, + { + title: gettext('Confirm'), + layout: 'fit', + items: [ + { + xtype: 'grid', + itemId: 'summary', + store: { fields: ['key', 'value'] }, + columns: [ + { + text: gettext('Setting'), + dataIndex: 'key', + width: 280, + renderer: Ext.htmlEncode, + }, + { + text: gettext('Value'), + dataIndex: 'value', + flex: 1, + cellWrap: true, + renderer: Ext.htmlEncode, + }, + ], + }, + ], + listeners: { activate: () => me.updateSummary() }, + onSubmit: () => me.finish(), + }, + ]; + me.callParent(); + let tabs = me.down('#wizcontent'); + tabs.on('tabchange', function (tp, tab) { + if (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')); + me.on('destroy', () => me.reloadCallback?.()); + }, +}); diff --git a/www/manager6/window/SANLunState.js b/www/manager6/window/SANLunState.js new file mode 100644 index 000000000..154836f3b --- /dev/null +++ b/www/manager6/window/SANLunState.js @@ -0,0 +1,111 @@ +Ext.define('pve-san-lun-node', { + extend: 'Ext.data.Model', + idProperty: 'node', + fields: ['node', 'state', 'paths-active', 'paths-total', 'paths-expected'], +}); + +// Shows the state of the LUN of a new storage on each of its nodes, from the cluster-wide status. +Ext.define('PVE.window.SANLunState', { + extend: 'Ext.window.Window', + + modal: true, + width: 550, + height: 400, + layout: { type: 'vbox', align: 'stretch' }, + bodyPadding: 10, + + initComponent: function () { + let me = this; + if (!me.wwid || !me.storage) { + throw 'no LUN or storage specified'; + } + me.title = Ext.String.format(gettext('Storage {0}: LUN State'), me.storage); + // The other nodes set up a new LUN with their next status updates. + let pendingUntil = Date.now() + 60000; + let rstore = Ext.create('Proxmox.data.UpdateStore', { + storeid: 'san-lun-state', + model: 'pve-san-lun-node', + interval: 3000, + proxy: { + type: 'proxmox', + url: '/api2/json/cluster/multipath/status', + reader: { + type: 'json', + rootProperty: 'data', + transform: function (raw) { + let lun = raw.data?.luns?.find((entry) => entry.wwid === me.wwid); + let nodes = Object.entries(lun?.nodes ?? {}); + return { ...raw, data: nodes.map(([node, state]) => ({ ...state, node })) }; + }, + }, + }, + }); + let store = Ext.create('Proxmox.data.DiffStore', { + rstore, + sorters: ['node'], + sortAfterUpdate: true, + }); + me.items = [ + { + xtype: 'component', + 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.storage, + ), + ), + }, + { + xtype: 'grid', + flex: 1, + store, + disableSelection: true, + emptyText: gettext('No node reported this LUN yet.'), + columns: [ + { + text: gettext('Node'), + dataIndex: 'node', + flex: 1, + renderer: Ext.htmlEncode, + }, + { + text: gettext('State'), + dataIndex: 'state', + flex: 1, + renderer: function (value, metaData, rec) { + if (value === 'missing' && Date.now() < pendingUntil) { + let tip = gettext( + 'Not reported by the node yet; the SAN view shows that as "Missing".', + ); + metaData.tdAttr = `data-qtip="${Ext.htmlEncode(Ext.htmlEncode(tip))}"`; + return ` ${Ext.htmlEncode(gettext('Pending'))}`; + } + return PVE.SANUtils.renderState( + PVE.SANUtils.lunState(value, rec.get('paths-total')), + ); + }, + }, + { + text: gettext('Active Paths'), + dataIndex: 'paths-active', + width: 120, + renderer: (value, metaData, rec) => + value === undefined + ? '' + : Ext.htmlEncode(PVE.SANUtils.pathCount(rec.data)), + }, + ], + }, + ]; + me.callParent(); + Proxmox.Utils.monStoreErrors(me.down('grid'), rstore); + me.on('destroy', function () { + store.destroy(); + rstore.destroy(); + }); + rstore.startUpdate(); + }, +});