hi,

patch looks good, but maybe we want to put this in the advanced options instead ? do you have any strong opinion on that @thomas?

On 10/31/18 11:32 PM, Nick Chevsky wrote:
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 <nchev...@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(
            {



_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to