From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A1CF01FF142 for ; Fri, 22 May 2026 15:05:04 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6302CAD5A; Fri, 22 May 2026 15:05:04 +0200 (CEST) From: Lukas Sichert To: pve-devel@lists.proxmox.com Subject: [PATCH manager v6 2/2] fix #7339: lvmthick: ui: add UI option to free storage Date: Fri, 22 May 2026 15:04:14 +0200 Message-ID: <20260522130419.94386-3-l.sichert@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260522130419.94386-1-l.sichert@proxmox.com> References: <20260522130419.94386-1-l.sichert@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779455052212 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.444 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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: TAXSIHFO65IYICHC7AISLUUQTWKGOGRP X-Message-ID-Hash: TAXSIHFO65IYICHC7AISLUUQTWKGOGRP X-MailFrom: l.sichert@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 CC: Lukas Sichert X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In the commit 'fix #7339: lvmthick: add worker to free space of to be deleted VMs' for the 'pve-storage' repo the backend received the functionality to discard allocated space of a VM disk on a SAN, when a VM is deleted. The backend checks whether to use this option by parsing storage.cfg for the 'on-volume-remove' property string and checking if the 'discard' property is set. The variable 'on-volume-remove' will automatically be stored into the config file if it is present in the 'PUT' API request. Expose this option in the GUI by adding a checkbox mapped to the local form field `on-remove-discard`. Use `cbind` with `isCreate` so the checkbox is enabled by default only when creating a new LVM storage. Map `on-remove-discard` to the `discard` property of the `on-volume-remove` property string. If at least one `on-volume-remove` option is enabled, serialize the selected options into `on-volume-remove` and include it in the returned API parameters. Also rename the 'imgdel' task description from 'Erase data' to 'Destroy image', since the task can now also discard storage blocks in addition to zeroing data. Signed-off-by: Lukas Sichert --- www/manager6/Utils.js | 2 +- www/manager6/storage/LVMEdit.js | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 2ed4e65d..0378ecac 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -2179,7 +2179,7 @@ Ext.define('PVE.Utils', { hastart: ['HA', gettext('Start')], hastop: ['HA', gettext('Stop')], imgcopy: ['', gettext('Copy data')], - imgdel: ['', gettext('Erase data')], + imgdel: ['', gettext('Destroy image')], lvmcreate: [gettext('LVM Storage'), gettext('Create')], lvmremove: ['Volume Group', gettext('Remove')], lvmthincreate: [gettext('LVM-Thin Storage'), gettext('Create')], diff --git a/www/manager6/storage/LVMEdit.js b/www/manager6/storage/LVMEdit.js index 148f0601..bdf33ca2 100644 --- a/www/manager6/storage/LVMEdit.js +++ b/www/manager6/storage/LVMEdit.js @@ -148,6 +148,39 @@ Ext.define('PVE.storage.LVMInputPanel', { onlineHelp: 'storage_lvm', + onGetValues: function(values) { + let me = this; + + let onRemove = {}; + if (values['on-remove-discard']) { + onRemove.discard = 1; + } + delete values['on-remove-discard']; + + let onRemoveString = PVE.Parser.printPropertyString(onRemove); + if (onRemoveString !== '') { + values['on-volume-remove'] = onRemoveString; + } else if (!me.isCreate) { + if (!values.delete) { + values.delete = []; + } + values.delete.push('on-volume-remove'); + } + + return me.callParent([values]); + }, + + setValues: function(values) { + if (values['on-volume-remove']) { + let onRemove = PVE.Parser.parsePropertyString(values['on-volume-remove']); + values['on-remove-discard'] = onRemove.discard; + } + + delete values['on-volume-remove']; + + return this.callParent([values]); + }, + column1: [ { xtype: 'pveBaseStorageSelector', @@ -241,5 +274,20 @@ Ext.define('PVE.storage.LVMInputPanel', { uncheckedValue: 0, fieldLabel: gettext('Wipe Removed Volumes'), }, + { + xtype: 'proxmoxcheckbox', + name: 'on-remove-discard', + uncheckedValue: 0, + cbind: { + checked: '{isCreate}', + }, + fieldLabel: gettext('Discard Removed Volumes'), + autoEl: { + tag: 'div', + 'data-qtip': gettext( + 'Enable to issue discard (TRIM) requests for logical volumes before removing them.', + ), + }, + }, ], }); -- 2.47.3