[pve-devel] [PATCH manager v3 6/8] When inside the wizard, actualize the scsiType display field based on iothread selection
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Sep 27 11:45:19 CEST 2017
On 09/26/2017 02:17 PM, Emmanuel Kasper wrote:
> 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.
Please try to keep commit message line length below 70 characters long.
First line (heading) is preferred to be even a bit shorter to allow space
for mail list and patch tags.
As this and the heading have both 89 chars I could imagine that you just
wrongly set the wrap length, e.g., textwidth in vim from 69 to 89.
> ---
> 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
Why event loop? I cannot see a cyclic change which could
cause it and failed to reproduce?
> + 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');
can we introduce a intermediate variable here? takes same line
length but is better readable than a split up object access.
> + }
> }
> }
> },
> @@ -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);
>
More information about the pve-devel
mailing list