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 3E51C1FF0AF for ; Fri, 06 Nov 2026 01:59:22 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 42C3D21ED2; Fri, 06 Nov 2026 01:51:23 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v3 manager 74/76] ui: storage wizard: do not offer LUNs in use for a new volume group Date: Fri, 6 Nov 2026 00:31:49 +0100 Message-ID: <20261105233336.2178064-75-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261105233336.2178064-1-t.lamprecht@proxmox.com> References: <20261105233336.2178064-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: 1793926182683 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.296 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: PC4PVADYCK7A4HAELQHGHB4QEPFGBCCX X-Message-ID-Hash: PC4PVADYCK7A4HAELQHGHB4QEPFGBCCX 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: The iSCSI and Fibre Channel setups offered every unused LUN for a new volume group, including LUNs that the scan node uses, for example through a device-mapper map built on one of their paths, and LUNs whose local users could not be checked. The node refuses a new volume group on such a LUN, so the setup failed at its last step instead. Show these LUNs as not selectable, naming the user or the failed check. Existing volume groups can still be reused. Signed-off-by: Thomas Lamprecht --- test/SANUtils_test.js | 17 +++++++++++++++++ www/manager6/SANUtils.js | 16 ++++++++++++++++ www/manager6/storage/wizard/FibreChannel.js | 2 +- www/manager6/storage/wizard/LunSelect.js | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/test/SANUtils_test.js b/test/SANUtils_test.js index b13d75166..86f97e9bd 100644 --- a/test/SANUtils_test.js +++ b/test/SANUtils_test.js @@ -88,3 +88,20 @@ test('paths of a LUN without a map', () => { lun = group(path('/dev/sdb', 'unknown', 'check failed'), path('/dev/sdc', 'yes', 'dm-5')); assert.equal(lun['in-use'], 'yes', 'a known user wins over a failed check'); }); + +test('LUNs not offered for a new volume group', () => { + const utils = sanUtils(); + const reason = (row) => utils.san_lun_in_use_reason({ usage: 'unused', ...row }, 'n1'); + + assert.equal(reason({ 'in-use': 'no' }), undefined); + assert.equal(reason({ 'in-use': 'yes', 'in-use-by': 'dm-5' }), 'In use on node "n1": dm-5'); + assert.equal( + reason({ 'in-use': 'unknown', 'in-use-by': 'check failed: timeout' }), + 'Could not check usage on node "n1"', + ); + assert.equal( + utils.san_lun_in_use_reason({ usage: 'lvm', 'in-use': 'yes', 'in-use-by': 'dm-5' }, 'n1'), + undefined, + 'an existing volume group stays available for reuse', + ); +}); diff --git a/www/manager6/SANUtils.js b/www/manager6/SANUtils.js index 801f77777..d3a50c1a9 100644 --- a/www/manager6/SANUtils.js +++ b/www/manager6/SANUtils.js @@ -367,6 +367,22 @@ Ext.define('PVE.SANUtils', { return Number(response?.result?.status) === 403; }, + // A node refuses a new volume group on an unused LUN that it uses or could not check, so the + // setup should not offer it. Returns the reason, or undefined for any other LUN. + san_lun_in_use_reason: function (row, node) { + if (row.usage !== 'unused' || row['in-use'] === 'no') { + return undefined; + } + if (row['in-use'] === 'yes') { + return Ext.String.format( + gettext('In use on node "{0}": {1}'), + node, + row['in-use-by'] ?? gettext('unknown'), + ); + } + return Ext.String.format(gettext('Could not check usage on node "{0}"'), node); + }, + // returns { text, tip } as HTML; an attribution to ownStorage alone does not count as use, and // refusal says why the row cannot be wiped san_lun_usage: function (row, { ownStorage, refusal } = {}) { diff --git a/www/manager6/storage/wizard/FibreChannel.js b/www/manager6/storage/wizard/FibreChannel.js index b44ec393a..265bc4a78 100644 --- a/www/manager6/storage/wizard/FibreChannel.js +++ b/www/manager6/storage/wizard/FibreChannel.js @@ -356,7 +356,7 @@ Ext.define('PVE.storage.wizard.FCLunSelect', { if (data.usage === 'unused' && !data['used-by-storage'] && !data['by-id']) { return gettext('The LUN has no stable device name for creating a volume group.'); } - return undefined; + return PVE.SANUtils.san_lun_in_use_reason(data, data.scanNode); }; let columns = me.lunColumns(); diff --git a/www/manager6/storage/wizard/LunSelect.js b/www/manager6/storage/wizard/LunSelect.js index 947105f4d..f8eba9e0a 100644 --- a/www/manager6/storage/wizard/LunSelect.js +++ b/www/manager6/storage/wizard/LunSelect.js @@ -71,7 +71,7 @@ Ext.define('PVE.storage.wizard.LunSelect', { if (mapped && !(row['paths-active'] > 0)) { return gettext('No usable path'); } - return undefined; + return PVE.SANUtils.san_lun_in_use_reason(row, me.node); }, wipeable: function (rec) { -- 2.47.3