[pve-devel] [PATCH changeme] Enable "Discard" option for IDE and SATA drives

Nick Chevsky nchevsky at gmail.com
Wed Nov 14 05:42:05 CET 2018


Even though QEMU supports the discard feature for both ATA [1] and
SCSI drives, the "Discard" checkbox in Proxmox VE is artificially
restricted to SCSI drives. This change expands availability of the
"Discard" checkbox to all drive types supported by QEMU, leaving
VirtIO Block as the only remaining exclusion.

Combined with the new "SSD emulation" option [2], enabling discard
on IDE/SATA drives allows reclaiming of free space on thin-provisioned
storage with guests that do not support our SCSI controllers.

[1] https://github.com/qemu/qemu/commit/d353fb72f59cd0e1f67baf773e74719cda761a89
[2] https://git.proxmox.com/?p=pve-manager.git;a=commit;h=6e40f7b0347e4275f6bcc7a484f930d4345d1c8e

Signed-off-by: Nick Chevsky <nchevsky at gmail.com>
---
pve-docs patch to follow.

 www/manager6/qemu/HDEdit.js | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 606ba4b8..84a80b2c 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -25,17 +25,14 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    }
 
 	    var virtio = value.match(/^virtio/);
+	    this.lookup('discard').setDisabled(virtio);
 	    this.lookup('ssd').setDisabled(virtio);
 	    if (virtio) {
+		this.lookup('discard').setValue(false);
 		this.lookup('ssd').setValue(false);
 	    }
 
-	    var scsi = value.match(/^scsi/);
-	    this.lookup('discard').setDisabled(!scsi);
-	    if (!scsi) {
-		this.lookup('discard').setValue(false);
-	    }
-	    this.lookup('scsiController').setVisible(scsi);
+	    this.lookup('scsiController').setVisible(value.match(/^scsi/));
 	},
 
 	control: {
@@ -264,7 +261,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    {
 		xtype: 'proxmoxcheckbox',
 		fieldLabel: gettext('Discard'),
-		disabled: me.confid && !me.confid.match(/^scsi/),
+		disabled: me.confid && me.confid.match(/^virtio/),
 		reference: 'discard',
 		name: 'discard'
 	    }
-- 
2.13.3.windows.1




More information about the pve-devel mailing list