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

Emmanuel Kasper e.kasper at proxmox.com
Mon Oct 2 10:37:35 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.
---
 www/manager6/qemu/HDEdit.js | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 075ad667..814097b1 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('scsiType').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;
@@ -198,9 +207,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