]> git.proxmox.com Git - pve-manager.git/commitdiff
Add "SSD emulation" property to IDE, SATA, and SCSI drives
authorNick Chevsky <nchevsky@gmail.com>
Thu, 8 Nov 2018 18:17:19 +0000 (13:17 -0500)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 9 Nov 2018 08:33:26 +0000 (09:33 +0100)
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 <nchevsky@gmail.com>
www/manager6/qemu/HDEdit.js

index 4b6039a7510632a1196e22539f6fca61a04bf92a..606ba4b87957cb119a399e07b1ee2eb190b084eb 100644 (file)
@@ -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',