Add "SSD emulation" property to IDE, SATA, and SCSI drives

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>
This commit is contained in:
Nick Chevsky 2018-11-08 13:17:19 -05:00 committed by Thomas Lamprecht
parent 237245957f
commit f9261fde21

View 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',