When enabled, the "SSD emulation" feature exposes drives as
solid-state (rather than rotational) by enabling the new `ssd`
qm.conf flag [1] on the drives, which in turn sets QEMU's
`rotation_rate` property [2, 3] on the underlying devices.

This change also moves the "Discard" option out of the advanced
section and promotes it to the top of the dialog box, as proposed
by Thomas Lamprecht [4].

[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
[4] https://pve.proxmox.com/pipermail/pve-devel/2018-November/034327.html

Signed-off-by: Nick Chevsky <[email protected]>
---
Changes since v1:
 * move the new "SSD" checkbox down to the advanced section,
 * move the existing "Discard" checkbox up to the main section, and
 * rename the new checkbox from "SSD" to "SSD emulation."

 www/manager6/qemu/HDEdit.js | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 4b6039a7..606ba4b8 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) {
@@ -85,6 +91,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
            delete me.drive.discard;
        }
 
+       if (values.ssd) {
+           me.drive.ssd = 'on';
+       } else {
+           delete me.drive.ssd;
+       }
+
        if (values.iothread) {
            me.drive.iothread = 'on';
        } else {
@@ -160,6 +172,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
        values.diskformat = drive.format || 'raw';
        values.cache = drive.cache || '__default__';
        values.discard = (drive.discard === 'on');
+       values.ssd = PVE.Parser.parseBoolean(drive.ssd);
        values.iothread = PVE.Parser.parseBoolean(drive.iothread);
 
        values.mbps_rd = drive.mbps_rd;
@@ -241,21 +254,30 @@ Ext.define('PVE.qemu.HDInputPanel', {
            });
        }
 
-       me.column2.push({
-           xtype: 'CacheTypeSelector',
-           name: 'cache',
-           value: '__default__',
-           fieldLabel: gettext('Cache')
-       });
-
-       me.advancedColumn1.push(
+       me.column2.push(
+           {
+               xtype: 'CacheTypeSelector',
+               name: 'cache',
+               value: '__default__',
+               fieldLabel: gettext('Cache')
+           },
            {
                xtype: 'proxmoxcheckbox',
                fieldLabel: gettext('Discard'),
                disabled: me.confid && !me.confid.match(/^scsi/),
                reference: 'discard',
-               labelWidth: labelWidth,
                name: 'discard'
+           }
+       );
+
+       me.advancedColumn1.push(
+           {
+               xtype: 'proxmoxcheckbox',
+               disabled: me.confid && me.confid.match(/^virtio/),
+               fieldLabel: gettext('SSD emulation'),
+               labelWidth: labelWidth,
+               name: 'ssd',
+               reference: 'ssd'
            },
            {
                xtype: 'proxmoxcheckbox',
-- 
2.13.3.windows.1

_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to