[pve-devel] [PATCH manager v5 6/8] Update VM SCSI type based on iothread value when inside the wizard

Emmanuel Kasper e.kasper at proxmox.com
Thu Oct 5 15:41:55 CEST 2017


We keep the same logic as before: once the iothread option is selected,
the SCSI controller is switched to virtio-scsi-single, until iothread
is unselected again.
---
rebase after 5/8 changed

 www/manager6/qemu/HDEdit.js | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index b6f08080..2b860d8f 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -74,6 +74,15 @@ Ext.define('PVE.qemu.HDInputPanel', {
 			me.hdsizesel.setVisible(true);
 		    }
 		}
+	    },
+	    'field[name=iothread]' : {
+		change: function(f, value) {
+		    if (!this.getView().insideWizard) {
+			return;
+		    }
+		    var vmScsiType = value ? 'virtio-scsi-single': 'virtio-scsi-pci';
+		    this.lookupReference('scsiController').setValue(vmScsiType);
+		}
 	    }
 	}
     },
@@ -116,10 +125,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 +135,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;
@@ -197,10 +206,14 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
 	    });
 	    me.column1.push(me.bussel);
+
 	    me.scsiController = Ext.create('Ext.form.field.Display', {
+		name: 'scsihw',
 		fieldLabel: gettext('SCSI Controller'),
 		reference: 'scsiController',
 		renderer: PVE.Utils.render_scsihw,
+		// do not change a VM wide option after creation
+		submitValue: me.insideWizard,
 		hidden: true
 	    });
 	    me.column1.push(me.scsiController);
-- 
2.11.0





More information about the pve-devel mailing list