[pve-devel] [PATCH pve-manager] Add "SSD" property to IDE, SATA, and SCSI hard drives

Nick Chevsky nchevsky at gmail.com
Wed Oct 31 23:32:29 CET 2018


When enabled, the "SSD" property exposes drives as SSDs (rather than
rotational hard disks) by enabling the new `ssd` back-end flag [1] on
the drives, which in turn sets QEMU's `rotation_rate` property [2, 3]
on the underlying devices. This is required to enable support for TRIM
and SSD-specific optimizations in guest operating systems that are
limited to emulated controller types (IDE, AHCI, and non-VirtIO SCSI).

[1] https://git.proxmox.com/?p=qemu-server.git;a=commit;h=6c875f9f315f2dc7a0a3a988622c2efdf089b171
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1498042
[3] https://lists.gnu.org/archive/html/qemu-devel/2017-10/msg00698.html

Signed-off-by: Nick Chevsky <nchevsky at gmail.com>
---
 www/manager6/qemu/HDEdit.js | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 4b6039a7..7e132bfb 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -24,6 +24,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		this.lookup('iothread').setValue(false);
 	    }
 
+	    var virtio = value.match(/^virtio/);
+	    this.lookup('ssd').setDisabled(virtio);
+	    if (virtio) {
+		this.lookup('ssd').setValue(false);
+	    }
+
 	    var scsi = value.match(/^scsi/);
 	    this.lookup('discard').setDisabled(!scsi);
 	    if (!scsi) {
@@ -97,6 +103,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    delete me.drive.cache;
 	}
 
+	if (values.ssd) {
+	    me.drive.ssd = 'on';
+	} else {
+	    delete me.drive.ssd;
+	}
+
 	if (values.scsihw) {
 	    params.scsihw = values.scsihw;
 	}
@@ -159,6 +171,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	values.noreplicate = !PVE.Parser.parseBoolean(drive.replicate, 1);
 	values.diskformat = drive.format || 'raw';
 	values.cache = drive.cache || '__default__';
+	values.ssd = PVE.Parser.parseBoolean(drive.ssd);
 	values.discard = (drive.discard === 'on');
 	values.iothread = PVE.Parser.parseBoolean(drive.iothread);
 
@@ -241,12 +254,21 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    });
 	}
 
-	me.column2.push({
-	    xtype: 'CacheTypeSelector',
-	    name: 'cache',
-	    value: '__default__',
-	    fieldLabel: gettext('Cache')
-	});
+	me.column2.push(
+	    {
+		xtype: 'CacheTypeSelector',
+		name: 'cache',
+		value: '__default__',
+		fieldLabel: gettext('Cache')
+	    },
+	    {
+		xtype: 'proxmoxcheckbox',
+		fieldLabel: gettext('SSD'),
+		disabled: me.confid && me.confid.match(/^virtio/),
+		reference: 'ssd',
+		name: 'ssd'
+	    }
+	);
 
 	me.advancedColumn1.push(
 	    {
-- 
2.13.3.windows.1




More information about the pve-devel mailing list