[pve-devel] [PATCH manager v2] fix #973: disable iothread for non-virtio drives

Dominik Csapak d.csapak at proxmox.com
Tue May 3 14:03:31 CEST 2016


this patch disables the iothread field, whenever the disk
is not a virtio disk, or the selected controller is not
virtio

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
 * no unnecessary itemids
 * also match scsi (we check in the backend if it is the correct controller)
 * use viewcontroller instead of managed listener

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

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index a360f23..1f5bfed 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -39,7 +39,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    delete me.drive.discard;
 	}
 
-	if (values.iothread && confid.match(/^virtio\d+$/)) {
+	if (values.iothread && confid.match(/^(virtio|scsi)\d+$/)) {
 	    me.drive.iothread = 'on';
 	} else {
 	    delete me.drive.iothread;
@@ -114,8 +114,20 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	me.column2 = [];
 
 	if (!me.confid || me.unused) {
+	    var onControllerChange = function(conbox) {
+		me.down('field[name=iothread]').setDisabled(!conbox.value.match(/^(virtio|scsi)/));
+	    };
 	    me.bussel = Ext.createWidget('PVE.form.ControllerSelector', {
-		vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {}
+		vmconfig: me.insideWizard ? {ide2: 'cdrom'} : {},
+		controller: {
+		    xclass: 'Ext.app.ViewController',
+		    control: {
+			'field[name=controller]' : {
+			    change: onControllerChange,
+			    afterrender: onControllerChange
+			}
+		    }
+		}
 	    });
 	    me.column1.push(me.bussel);
 	}
@@ -241,6 +253,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
 	me.column2.push({
 	    xtype: 'pvecheckbox',
+	    disabled: me.insideWizard || (me.confid && !me.confid.match(/^(virtio|scsi)/)),
 	    fieldLabel: gettext('IO thread'),
 	    name: 'iothread'
 	});
-- 
2.1.4





More information about the pve-devel mailing list