[pve-devel] [PATCH manager v3 6/8] When inside the wizard, actualize the scsiType display field based on iothread selection
Emmanuel Kasper
e.kasper at proxmox.com
Tue Sep 26 14:17:17 CEST 2017
We keep the same logic as before: once the iothread option is selected, the default SCSI
controller is switched to virtio-scsi-single until iothread is unselected again.
---
www/manager6/qemu/HDEdit.js | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 075ad667..14ee0b50 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -19,9 +19,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
var value = field.getValue();
var allowIOthread = value.match(/^(virtio|scsi)/);
- this.lookup('iothread').setDisabled(!allowIOthread);
+ var iothread = this.lookup('iothread');
+ iothread.setDisabled(!allowIOthread);
if (!allowIOthread) {
- this.lookup('iothread').setValue(false);
+ // prevent event loop
+ iothread.suspendEvent('change');
+ iothread.setValue(false);
+ iothread.resumeEvent('change');
}
var scsi = value.match(/^scsi/);
@@ -74,6 +78,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
me.hdsizesel.setVisible(true);
}
}
+ },
+ 'field[name=iothread]' : {
+ change: function(f, value) {
+ if (!this.getView().insideWizard) {
+ return;
+ }
+ this.lookupReference('scsiType')
+ .setValue(value ? 'virtio-scsi-single' : 'virtio-scsi-pci');
+ }
}
}
},
@@ -116,10 +129,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
if (values.iothread) {
me.drive.iothread = 'on';
- // do not silently change a VM-wide option after creating it
- if (me.insideWizard) {
- params.scsihw = 'virtio-scsi-single';
- }
} else {
delete me.drive.iothread;
}
@@ -130,6 +139,10 @@ Ext.define('PVE.qemu.HDInputPanel', {
delete me.drive.cache;
}
+ if (values.scsihw) {
+ params.scsihw = values.scsihw;
+ }
+
params[confid] = PVE.Parser.printQemuDrive(me.drive);
return params;
@@ -198,9 +211,12 @@ Ext.define('PVE.qemu.HDInputPanel', {
});
me.column1.push(me.bussel);
me.scsiType = Ext.create('Ext.form.field.Display', {
+ name: 'scsihw',
fieldLabel: gettext('Type'),
reference: 'scsiType',
renderer: PVE.Utils.render_scsihw,
+ // do not change a VM wide option after creation
+ submitValue: me.insideWizard,
hidden: true
});
me.column1.push(me.scsiType);
--
2.11.0
More information about the pve-devel
mailing list