create: clear iothread on disable

A user may set the `iothread` option and then change the bus type to
something which does not support it (sata, ide), while we disable
it the previously set value remains, which is confusing.
An user could think he coulkd trick the Wizard into using iothreads
for SATA/IDE but we just ignore the value in this case.

Set iothread to false in the case it gets disabled.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2017-08-29 12:08:29 +02:00 committed by Fabian Grünbichler
parent 2a2dce7037
commit ed1ac8f4b3

View File

@ -17,7 +17,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
onControllerChange: function(field) { onControllerChange: function(field) {
var value = field.getValue(); var value = field.getValue();
this.lookup('iothread').setDisabled(!value.match(/^(virtio|scsi)/));
var allowIOthread = value.match(/^(virtio|scsi)/);
this.lookup('iothread').setDisabled(!allowIOthread);
if (!allowIOthread) {
this.lookup('iothread').setValue(false);
}
}, },
control: { control: {
@ -102,7 +107,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
delete me.drive.discard; delete me.drive.discard;
} }
if (values.iothread && confid.match(/^(virtio|scsi)\d+$/)) { if (values.iothread) {
me.drive.iothread = 'on'; me.drive.iothread = 'on';
// do not silently change a VM-wide option after creating it // do not silently change a VM-wide option after creating it
if (me.insideWizard) { if (me.insideWizard) {
@ -273,7 +278,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
}, },
{ {
xtype: 'pvecheckbox', xtype: 'pvecheckbox',
disabled: me.insideWizard || (me.confid && !me.confid.match(/^(virtio|scsi)/)), disabled: me.confid && !me.confid.match(/^(virtio|scsi)/),
fieldLabel: gettext('IO thread'), fieldLabel: gettext('IO thread'),
reference: 'iothread', reference: 'iothread',
name: 'iothread' name: 'iothread'